用户'DOMAIN \USERID $'登录失败 [英] Login failed for user 'DOMAIN\USERID$'
问题描述
我的.net问题。从VS 2010运行时,该应用程序运行正常,但当它被放置在测试内联网服务器上时,我收到消息异常详细信息:System.Data.SqlClient.SqlInternalConnection.OnError:
I have an issue with .net. The app works flawlessly when running from VS 2010, yet when it is placed on the test intranet server I get the message "Exception Details: System.Data.SqlClient.SqlInternalConnection.OnError:
Login failed for user 'domain\servername$'. at system.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
我正在使用Windows集成身份验证。
在网络配置中,我尝试了以下内容:
I'm using windows integrated authentication.
In the web config, I have tried the following below:
<add name="ConnectionString" connectionString="Data Source=abc;Initial Catalog=xyz;User ID=admin;Password=pw123;Trusted_Connection=true"></add>
和
and
<add name="ConnectionString" connectionString="Data Source=abc;Initial Catalog=xyz;User ID=admin;Password=pw123;Integrated Security=SSPI;Persist Security Info=False"></add>
我还在IIS 7中将应用程序池更改为网络服务
这是完整的错误信息:
I have also changed in IIS 7 the application pool to "Network Service"
Here's the full error message:
<?xml version="1.0" encoding="utf-8" ?>
<string xmlns="http://tempuri.org/">Login failed for user 'domain\servername$'. at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) at System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean enlistOK) at System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean ignoreSniOpenTimeout, TimeoutTimer timeout, Boolean withFailover) at System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString connectionOptions, SqlCredential credential, TimeoutTimer timeout) at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(TimeoutTimer timeout, SqlConnectionString connectionOptions, SqlCredential credential, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance) at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions) at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions) at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool pool, DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectionOptions userOptions) at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnectionOptions userOptions) at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnectionOptions userOptions) at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection) at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection) at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection) at System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions) at System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry) at System.Data.SqlClient.SqlConnection.Open() at xxx.xxxService.GetCode(String RKey) in E:\abc\xxx\xxx\xxxService.asmx.cs:line 45</string>
我有烙印在网上发布并找不到解决方案。我将不胜感激。
I have searched on the web and have found no solution. I would appreciate any help.
推荐答案
'。 at system.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception,Boolean breakConnection,Action`1 wrapCloseInAction)
'. at system.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
我正在使用windows综合认证。
在网络配置中,我尝试了以下内容:
I'm using windows integrated authentication.
In the web config, I have tried the following below:
<add name="ConnectionString" connectionString="Data Source=abc;Initial Catalog=xyz;User ID=admin;Password=pw123;Trusted_Connection=true"></add>
和
and
<add name="ConnectionString" connectionString="Data Source=abc;Initial Catalog=xyz;User ID=admin;Password=pw123;Integrated Security=SSPI;Persist Security Info=False"></add>
我还在IIS 7中将应用程序池更改为网络服务
这里是完整的错误消息:
I have also changed in IIS 7 the application pool to "Network Service"
Here's the full error message:
<?xml version="1.0" encoding="utf-8" ?>
<string xmlns="http://tempuri.org/">Login failed for user 'domain\servername
'登录失败。在System.Data.SqlClient.SqlInternalConnection.OnError(SqlException异常,布尔breakConnection,Action`1 wrapCloseInAction)在System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj,布尔callerHasConnectionLock,布尔asyncClose)在System.Data.SqlClient.TdsParser .TryRun(RunBehavior runBehavior,SqlCommand的cmdHandler,SqlDataReader的数据流,BulkCopySimpleResultSet bulkCopyHandler,TdsParserStateObject stateObj,布尔&安培; dataReady)在System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior,SqlCommand的cmdHandler,SqlDataReader的数据流,BulkCopySimpleResultSet bulkCopyHandler,TdsParserStateObject stateObj)在系统.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(布尔enlistOK)在System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(serverInfo serverInfo,字符串NEWPASSWORD,SecureString的newSecurePassword,布尔ignoreSniOpenTimeout,TimeoutTimer超时,布尔withFailover)在System.Data.SqlClient.SqlIn System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(TimeoutTimer timeout,SqlConnectionString connectionOptions,SqlCredential credential,String newPassword,SecureString newSecurePassword)中的ternalConnectionTds.LoginNoFailover(ServerInfo serverInfo,String newPassword,SecureString newSecurePassword,Boolean redirectedUserInstance,SqlConnectionString connectionOptions,SqlCredential credential,TimeoutTimer timeout) System.Data.SqlClient.SqlConnectionFactory.CreateConnection上的System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity标识,SqlConnectionString connectionOptions,SqlCredential凭证,Object providerInfo,String newPassword,SecureString newSecurePassword,Boolean redirectedUserInstance,SqlConnectionString userConnectionOptions)中的,Boolean redirectedUserInstance) (DbConnectionOptions选项,DbConnectionPoolKey poolKey,Object poolGroupProviderInfo,DbConnectionPool池,DbConnection owningConnection,DbConnectionOptions用户System.Data.ProviderBase.DbConnectionPool.UserCreateRequest上System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnectionOptions userOptions)的System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool池,DbConnectionOptions选项,DbConnectionPoolKey poolKey,DbConnectionOptions userOptions)处的选项)( DbConnectionOptions USEROPTIONS)在System.Data.ProviderBase.DbConnectionPool.TryGetConnection(的DbConnection owningObject,UInt32的waitForMultipleObjectsTimeout,布尔allowCreate,布尔onlyOneCheckConnection,DbConnectionOptions USEROPTIONS,DbConnectionInternal&安培; System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection,TaskCompletionSource`1 retry,DbConnectionOptions userOptions,System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject,TaskCompletionSource`1 retry,DbConnectionOptions userOptions,DbConnectionInternal& connection)处的连接)在System.Data的System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1重试)处的System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection,DbConnectionFactory connectionFactory,TaskCompletionSource`1 retry,DbConnectionOptions userOptions)处的DbConnectionInternal& connection。 SqlClient.SqlConnection.Open()位于Exx中的xxx.xxxService.GetCode(String RKey):\ abc \ xxx \ xxxx \ xxx.Service.asmx.cs:第45行< ; / string >
'. at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) at System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean enlistOK) at System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean ignoreSniOpenTimeout, TimeoutTimer timeout, Boolean withFailover) at System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString connectionOptions, SqlCredential credential, TimeoutTimer timeout) at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(TimeoutTimer timeout, SqlConnectionString connectionOptions, SqlCredential credential, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance) at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions) at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions) at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool pool, DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectionOptions userOptions) at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnectionOptions userOptions) at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnectionOptions userOptions) at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection) at System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection) at System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection) at System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions) at System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry) at System.Data.SqlClient.SqlConnection.Open() at xxx.xxxService.GetCode(String RKey) in E:\abc\xxx\xxx\xxxService.asmx.cs:line 45</string>
我有烙印在网上发布并找不到解决方案。我将不胜感激任何帮助。
I have searched on the web and have found no solution. I would appreciate any help.
问题出在您的连接字符串中。在这两个示例中,您都强制它使用Trusted_Connection = true的Windows身份验证;和集成安全性= SSPI;即使您包含登录名和密码,这些选项中的每一个都会告诉它使用Windows身份验证。
尝试使用
The problem is in your connection string. In both both examples you are forcing it to use Windows Authentication with Trusted_Connection=true; and Integrated Security=SSPI;. Each of these options tell it to use Windows Authentication even if you include a login and password.
Try using
<add name="ConnectionString" connectionString="Data Source=abc;Initial Catalog=xyz;User ID=admin;Password=pw123;</add>
您可以查看 https://www.connectionstrings.com/ [ ^ ]了解有关连接字符串选项的更多信息。
You can check out https://www.connectionstrings.com/[^] to learn more about connect string options.
这篇关于用户'DOMAIN \USERID $'登录失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!