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

475 views Asked by At

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 .

1

There are 1 answers

0
Amit On

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.