简体   繁体   中英

ASP.NET Web Site Administration Security section: Unable to connect to SQL Server database

I am developing an ASP.NET application using MS VS 2013 and MS SQL Server 2014. When i start ASP.NET Web Site Administration Tool by CMD and click on security tab, I get below 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. "

my web.config setting:

<configuration>
  <connectionStrings>
    <add name="newsdbConnectionString"
     connectionString="Data Source=(LocalDB)\v11.0;AttachDbFilename=|DataDirectory|\newsdb.mdf;Integrated Security=True;Connect Timeout=30"
  providerName="System.Data.SqlClient" />
  </connectionStrings>
  <system.web>
    <compilation debug="true" targetFramework="4.5">
      <assemblies>
        <add assembly="System.Data.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
      </assemblies>
    </compilation>
    <httpRuntime targetFramework="4.5"/>
  </system.web>
</configuration>

What is the problem .

Try below connection string and check.

Server=.\SQLExpress;AttachDbFilename=|DataDirectory|mydbfile.mdf;Database=dbname;
Trusted_Connection=Yes;

Server=(localdb)\v11.0;Integrated Security=true;
AttachDbFileName==|DataDirectory|mydbfile.mdf;

And ensure that mdf file is located in published App_Data folder.

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