简体   繁体   中英

Unable to connect to SQL Server database in asp.net Web Site Administration Tool

When I get on the Security tab on the Web Site Administration Tool, I get this Error:

There is a problem with your selected data store. This can be caused by an invalid server name or credentials, or by insufficient permission. It can also be caused by the role manager feature not being enabled. Click the button below to be redirected to a page where you can choose a new data store.

The following message may help in diagnosing the problem: Unable to connect to SQL Server database.

Here is the connectionStrings part in web.config file:

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

And here is the membership part:

<membership>
  <providers>
    <add connectionStringName="DefaultConnection" enablePasswordRetrieval="false"
      enablePasswordReset="true" requiresQuestionAndAnswer="false"
      requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6"
      minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10"
      applicationName="/" name="DefaultMembershipProvider" type="System.Web.Providers.DefaultMembershipProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
  </providers>
</membership>

I've been searching the internet for solution for hours now, but can't find anything. Can somebody please help? Thanks!

EDIT

roleManager tag:

<roleManager>
  <providers>
    <add connectionStringName="DefaultConnection" applicationName="/"
      name="DefaultRoleProvider" type="System.Web.Providers.DefaultRoleProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
  </providers>
</roleManager>

It can also be caused by the role manager feature not being enabled.

Error message said roleManager is not enabled. Please enable it and test it again.

<roleManager defaultProvider="DefaultRoleProvider" enabled="true">
  <providers>
    ...
  </providers>
</roleManager>

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