c# - 系统.Data.SqlClient.SqlException : login failed for user '......'

标签 c# asp.net sql-server-2008 iis

我没有使用集成安全性。我在网上查过这个问题并尝试解决错误。到目前为止,没有任何效果或解决它。它不适用于 Visual Studio 中的 iis 和调试。这是我得到的错误:

详细信息 van uitzondering: System.Data.SqlClient.SqlException:用户 '.....' 登录失败。

Fout in bron:

Regel 7:    {
Regel 8:        SqlConnection myconnection = new SqlConnection(ConnectionClass.cnnConnectionVacature);
Regel 9:        myconnection.Open();
Regel 10: 
Regel 11:       //het laten zien van ingevoerde database gegevens 

Bronbestand: c:\inetpub\wwwroot\Vacaturesite\start.aspx.cs Regel:9

堆栈跟踪:

[SqlException (0x80131904): Login failed for user 'BPVICTwebuser'.]
   System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) +5340655
   System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) +244
   System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) +1691
   System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +69
   System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean enlistOK) +30
   System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean ignoreSniOpenTimeout, TimeoutTimer timeout, Boolean withFailover) +317
   System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo serverInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString connectionOptions, SqlCredential credential, TimeoutTimer timeout) +891
   System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(TimeoutTimer timeout, SqlConnectionString connectionOptions, SqlCredential credential, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance) +307
   System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData) +518
   System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions) +278
   System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnectionPool pool, DbConnection owningObject, DbConnectionOptions options, DbConnectionPoolKey poolKey, DbConnectionOptions userOptions) +38
   System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection) +732
   System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection) +85
   System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection) +1057
   System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection) +78
   System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource`1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection) +196
   System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions) +146
   System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource`1 retry, DbConnectionOptions userOptions) +16
   System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource`1 retry) +94
   System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource`1 retry) +110
   System.Data.SqlClient.SqlConnection.Open() +96
   Start.Page_Init(Object sender, EventArgs e) in c:\inetpub\wwwroot\Vacaturesite\start.aspx.cs:9
   System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +51
   System.Web.UI.Control.OnInit(EventArgs e) +92
   System.Web.UI.Page.OnInit(EventArgs e) +12
   System.Web.UI.Control.InitRecursive(Control namingContainer) +134
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +489

部分代码:

public static string cnnConnectionVacature
{
    get { return @"Data Source=SX047H\SQLEXPRESS;Initial Catalog=BPVICT_vacature;User ID=...;Password=..."; }
}

最佳答案

确保您已启用混合模式身份验证,这里有一篇描述如何启用它的分步文章 http://www.lansweeper.com/kb/23/SQLserver-enable-mixed-authentication.html

关于c# - 系统.Data.SqlClient.SqlException : login failed for user '......' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28210615/

相关文章:

c# - 在 SL ComboBox 上使用 CollectionView 刷新时 SelectedItemIndex 不匹配

c# - C# 中的枚举 bool 值

c# - 在 if 语句中求值?

sql - SQL Server 存储过程中的多列过滤

SQL Server 删除并重新创建表的索引

sql - 存储过程中的数据验证

c# - 从 C# List<object> 中获取重复项

c# - 如何将弱类型 ICollection 转换为 F# 列表?

c# - ASP.Net 无法成功登录/注册(可以在本地运行,但不能在 Azure 上运行)

c# - 如何在 Web Api 中使用 Httpclient 并响应 Ok 获取对象