0
當我嘗試登錄,則拋出異常:我有一個問題,連接字符串
無法打開數據庫「aspnetdb的」由登錄請求。登錄失敗。 用戶'DIMA-00AA1DA557 \ Dima'登錄失敗。
System.Data.SqlClient.SqlException:無法打開登錄請求的數據庫「aspnetdb」。登錄失敗
我的web.config:
<system.web>
<roleManager enabled="true" />
<membership defaultProvider="MyMembershipProvider">
<providers>
<clear/>
<add
name="MyMembershipProvider"
type="System.Web.Security.SqlMembershipProvider"
connectionStringName="LocalSqlServer"
requiresQuestionAndAnswer="false"
minRequiredPasswordLength="1"
minRequiredNonalphanumericCharacters="0"
enablePasswordReset="true"
maxInvalidPasswordAttempts="1000"
passwordAttemptWindow="4000"
enablePasswordRetrieval="true"
requiresUniqueEmail="false"
passwordFormat="Encrypted"
/>
</providers>
</membership>
</system.web>
我的連接字符串部分
<connectionStrings>
<clear />
<add name="LocalSqlServer"
connectionString="Data Source=localhost;Integrated Security=SSPI; Initial Catalog=aspnetdb" />
providerName="System.Data.SqlClient"
<add name="YourGuruDB"
connectionString="Data Source=DIMA-00AA1DA557;Initial Catalog=model;Integrated Security=True"/>
<add name="modelConnectionString"
connectionString="Data Source=DIMA-00AA1DA557;Initial Catalog=model;Integrated Security=True"
providerName="System.Data.SqlClient"/>
<add name="LocalSqlServer2"
connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename='D:\Documents and Settings\Dima\My Documents\Visual Studio 2010\WebSites\WebSite10\App_Data\ASPNETDB.MDF';Integrated Security=True;User Instance=True"
providerName="System.Data.SqlClient"/>
<add name="MyLocalSQLServer"
connectionString="Initial Catalog=aspnetdb;data source=localhost;Integrated Security=SSPI;" />
</connectionStrings>
那麼aspnetdb存在嗎?運行ASP .NET的身份是否可以訪問它? (您正在連接字符串中指定集成安全性)。 – driis 2011-05-26 08:06:25
通過編輯來格式化您的問題,而不是回答 – Reniuz 2011-05-26 08:06:27
是的,它確實存在。問題是當我試圖把連接字符串放入問題中,它不會放過它,它不會顯示它..所以我把它放在答案 – 2011-05-26 08:12:29