gpt4 book ai didi

c# - 如何修复 System.Data.SqlClient.SqlException : Login failed for user

转载 作者:行者123 更新时间:2023-12-05 07:33:45 25 4
gpt4 key购买 nike

<分区>

当我运行它时,我得到了这个:

Error Screenshot

我在IIS、SQL Server 中启用了Windows 身份验证,并且还在web.config 中添加了身份验证方法:

<system.web>
<authentication mode="Windows"/>
</system.web>

(我真的没主意了……)

如您所见,DataConnection 正在运行:

DataConnection Screenshot

来自 web.config 的连接字符串:

<connectionStrings>
<clear/>
<add name="cafeaconnection"
connectionString="Data source=LENOVO-PC\SQLEXPRESS; Initial catalog=tipuridecafeaDB; user id=user; password=password; persist security info=True;"
providerName="System.Data.SqlClient" />
<add name="ConnectionString"
connectionString="Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\tipuridecafeaDB.mdf;Integrated Security=True"
providerName="System.Data.SqlClient"/>
</connectionStrings>

错误:

[SqlException (0x80131904): Login failed for user 'Shade'.]

System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, SqlCredential credential, Object providerInfo, String newPassword, SecureString newSecurePassword, Boolean redirectedUserInstance, SqlConnectionString userConnectionOptions, SessionData reconnectSessionData, DbConnectionPool pool, String accessToken, Boolean applyTransientFaultHandling, SqlAuthenticationProviderManager sqlAuthProviderManager) +907
System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection, DbConnectionOptions userOptions) +334
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) +699
System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject, DbConnectionOptions userOptions, DbConnectionInternal oldConnection) +89
System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, UInt32 waitForMultipleObjectsTimeout, Boolean allowCreate, Boolean onlyOneCheckConnection, DbConnectionOptions userOptions, DbConnectionInternal& connection) +426
System.Data.ProviderBase.DbConnectionPool.TryGetConnection(DbConnection owningObject, TaskCompletionSource1 retry, DbConnectionOptions userOptions, DbConnectionInternal& connection) +78<br/>
System.Data.ProviderBase.DbConnectionFactory.TryGetConnection(DbConnection owningConnection, TaskCompletionSource
1 retry, DbConnectionOptions userOptions, DbConnectionInternal oldConnection, DbConnectionInternal& connection) +191
System.Data.ProviderBase.DbConnectionInternal.TryOpenConnectionInternal(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource1 retry, DbConnectionOptions userOptions) +154<br/>
System.Data.ProviderBase.DbConnectionClosed.TryOpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory, TaskCompletionSource
1 retry, DbConnectionOptions userOptions) +21
System.Data.SqlClient.SqlConnection.TryOpenInner(TaskCompletionSource1 retry) +90<br/>
System.Data.SqlClient.SqlConnection.TryOpen(TaskCompletionSource
1 retry) +443
System.Data.SqlClient.SqlConnection.Open() +96
YourCoffeeShop.App_Code.ConnectionClass.GetCafeaByType(String cafeaType) in D:\YCS\YourCoffeeShop\YourCoffeeShop\App_Code\ConnectionClass.cs:29
YourCoffeeShop.Pages.Cafea.FillPage() in D:\YCS\YourCoffeeShop\YourCoffeeShop\Pages\Cafea.aspx.cs:26
YourCoffeeShop.Pages.Cafea.Page_Load(Object sender, EventArgs e) in D:\YCS\YourCoffeeShop\YourCoffeeShop\Pages\Cafea.aspx.cs:17
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +51
System.Web.UI.Control.OnLoad(EventArgs e) +95
System.Web.UI.Control.LoadRecursive() +59
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +678

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com