2013-03-19 106 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,因此应首先检查连接字符串。尝试连接到数据库没有成员身份,如果完成,你可以走得更远。

相关问题