2013-03-19 78 views
1

嗨,我想在asp.net mvc 4中使用默認的asp.net成員資格提供程序,但它連接到數據庫時似乎失敗。下面是我在web.config中進行的設置:在嘗試創建用戶時網絡管理工具錯誤

<add name="MembershipConnectionString" connectionString="Data 
Source=(LocalDB)\v11.0;AttachDbFilename=|DataDirectory|\aspnetdb.mdf;Integrated 
Security=True" providerName="System.Data.SqlClient"/> 

<membership> 
    <providers> 
    <clear/> 
    <add name="AspNetSqlMembershipProvider" 
      type="System.Web.Security.SqlMembershipProvider" 
      connectionStringName="MembershipConnectionString" 
      enablePasswordRetrieval="false" 
      enablePasswordReset="true" 
      requiresQuestionAndAnswer="false" 
      requiresUniqueEmail="false" 
      maxInvalidPasswordAttempts="5"   
      minRequiredNonalphanumericCharacters="0" 
      passwordAttemptWindow="10" 
      applicationName="/" 
      passwordFormat="Hashed" 
     /> 
    </providers> 
</membership> 

我要指出,我從升級正則表達式的asp.net生成的數據庫,以我目前的SQL Server時,我添加的連接。

現在,當我嘗試打開ASP.NET Web站點Adminstration工具和我去安全,並試圖創建一個用戶或角色,我得到這個錯誤:

下面的消息可能在診斷問題幫助:

A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified) at System.Web.Administration.WebAdminPage.CallWebAdminHelperMethod(Boolean isMembership, String methodName, Object[] parameters, Type[] paramTypes) at ASP.security_users_adduser_aspx.PopulateCheckboxes() in c:\Windows\Microsoft.NET\Framework64\v4.0.30319\ASP.NETWebAdminFiles\Security\Users\addUser.aspx:line 28 at ASP.security_users_adduser_aspx.Page_Load() in c:\Windows\Microsoft.NET\Framework64\v4.0.30319\ASP.NETWebAdminFiles\Security\Users\addUser.aspx:line 22 at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) at System.Web.UI.Control.OnLoad(EventArgs e) at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

我在做什麼錯?

+0

您是否確定運行該站點的AppPool的用戶具有數據庫的登錄名以及選擇/插入/更新的正確權限? – 2013-03-19 09:25:50

+0

我不使用IIS只是與Visual Studio 2012自帶的默認IIS Express – aleczandru 2013-03-19 09:29:57

+0

「服務器未找到或無法訪問」 - 連接詳細信息是錯誤的 – 2013-03-19 10:39:36

回答

4

你確定datasourse是正確的嗎? 因爲貌似問題不在於成員身份,但它無法找到server.so,因此應首先檢查連接字符串。嘗試連接到數據庫沒有成員身份,如果完成,你可以走得更遠。

相關問題