Nick
Nick

Reputation: 19664

How do I get my ASP.Net MVC2 application to authenticate with the SQL Server using Sql Authentication?

I deployed an ASP.net MVC 2 application on my Windows Server 2008 IIS7 server and it bombs out reporting:

Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'.

I have SQL Server authentication enabled on the server and I have created a login for the database that I am trying to reach. I don't understand why the 'NT AUTHORITY\ANONYMOUS LOGON' credential is being used. This must be the context in which the application is running (application pool). I assumed that the application would just use the credentials specified in the connectionstring. How can configure IIS7 and/or ASP.net to just login using the user and pass provided in the connection string specified within the web.config?

Thanks a ton.

I'm pretty sure the problem is at the SQL Server or with my IIS configuration. The application works from my development machine.

Connnection String :

connectionString="Data Source=servername;Initial Catalog=TestPortal;User Id=username;Password=password;"

Upvotes: 0

Views: 560

Answers (2)

Nick
Nick

Reputation: 19664

By default Entity Framework connection string has:

Integrated Security=True;

This should be removed from both the asp.net membership provider connectionstring as well as from the entity framework's generated connectionstring.

Upvotes: 1

Darin Dimitrov
Darin Dimitrov

Reputation: 1038720

Your connection string should look like this:

Data Source=SomeServerName;Initial Catalog=SomeDB;User Id=user;Password=pwd;

And SQL authentication must be enabled on the SQL Server.

Upvotes: 0

Related Questions