1

I am trying to get authentication and authorization working with my ASP MVC project. I've run the aspnet_regsql.exe tool without any problem and see the aspnetdb database on my server (using the Management Studio tool).

my connection string in my web.config is:

 <connectionStrings>
<add name="ApplicationServices"
     connectionString="data source=MYSERVERNAME;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true"
     providerName="System.Data.SqlClient" />

The error I get is:

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.

In the past, I have had trouble connecting to my database because I've needed to add users. Do I have to do something similar here?

1
  • The way that you have the web.config I think you need to have integrated authentication enabled in IIS. Or your app pool identity would need access. How do you want your application to authenticate to SQL? I always use a static sql username and password... different strokes for different folks.
    – Linuxx
    Feb 24, 2016 at 1:12

1 Answer 1

-1

Try changing the connection string to the one below, and see if that helps any:

Data Source=MYSERVERNAME;Initial Catalog=DATABASENAME;Integrated Security=True

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .