I have freshly installed ISS with SQL server and asp.net mvc application. I want my app to use windows authentication. On my application side, i know that i have good connection string, because i was running it on my local machine and it was working fine.

On my new remote server, it does not want to work - so i changed connection string to use credentials - sa, and it worked. So i obviously am lacking some configuration there for windows auth.

As far I did is I added network service to my sql server logins, and granted it admin privileges. Also, my application pool is running as network service. It still doesn't work, what did i miss?

Edit for clarification: WinAuth is enabled in my sql server.

  • What error messages are you getting in the application? How about in the SQL ERRORLOG as well? – StrayCatDBA Feb 18 '13 at 16:22

I think the "Network Service" user is not working the way you expect.

Try setting the application pool to run as a particular user, and then add that same user to the slq server logins. Then under user mapping give that user the minimum set of permissions it needs to the particular DBs. Typically db_datareader and db_datawriter are sufficient.

Note, the user that you use doesn't need any special permissions on the machine. It could be a local user or a domain user that isn't a member of any security groups at all. If you create a new user specifically for this purpose, you can make it a standard user, then afterwards you can go into user manager and remove it from the users group so that it doesn't have any default access to the machine. This way you still get the advantage of using the Windows Authentication method in your connection string.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.