简体   繁体   中英

Error in Web SIte Administration tool when trying to create user

Hi, I am trying to use the default asp.net membership provider in asp.net mvc 4 but it seems to be failing when connecting to the database. Here are the settings I have made in 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>

I should mention that I upgraded the database generated from asp.net regex to my current SQL Server when I added the connection.

Now when I try to open the ASP.NET Web Site Adminstration Tool and I go to security and tried to create a user or a role I got this error:

The following message may help in diagnosing the problem:

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)

What am I doing wrong?

Are you sure datasourse is correct ? because looks like problem is not with membership but it is unable to find server.so you should check with connection string first. try to connect to database without membership first then if done,you can go further.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM