Membership Provider Connections to remote database in IIS7 Windows 2008 Web Server

I recently went through a nightmare with getting the Membership Provider Login and any other Membership Provider methods to work using Windows 2008 Web Server and IIS7 connecting to a remote SQL Server 2008 database.

I was consistently getting this error (using windows authentication):

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

From the web server, my web site could connect to the database, display a grid from the tables, insert and update tables, but could not perform any of the membership provider methods. When running my app locally via Visual Studio 2008, I could use the log in control fine, just not from the actual web application.

Thanks to Rick Anderson for his tenacity in sticking with me to find a solution, I am going to explain it here so you won't have to go through what I went through...

If you have your database connection working, but your Membership Provider log ins, etc. are failing, do this:

In IIS7 on your Windows 2008 Web Server... 

Please go to Application Pools.

Select your web site.

Click "Advanced Settings" in the "Actions" panel.

Under "Process Model" select "Identity."

In the popup, select the "Custom account" radio button.

"Set" the account and password to your dbo account name and password that are used on your SQL Server 2008 database.

Save that.

Under sites, go to your website. In the Features View panel, select "Authentication" under IIS. Under ASP.Net Impersonation, make sure it's Disabled.

Your web.config will be changed to this:
 <identity impersonate="false" />

You may wish to copy your web.config changes made on the server to your local web site in Visual Studo to get the latest copy.

May your dreams be in ASP.net!

Nannette

 

 

7 Comments

  • Hi Nannette,

    I am having the same problem also, however my hsoting is supplied by a hosting company so I do not have access to the Server settings. Any thought?

  • Thanx voor the sollution.. work finnaly!

    Webconfig:



  • I have the same problem but I am using Windows 7, MSSQL 2008 Express and IIS 7. I have my providers in a remote MSSQL 2008 database and in Visual Studio 2008 my login control works well but when I try to host in a machine with Win 7 and IIS all pages that access the database works well but login not as the user does not exist.
    Any idea?

    Thanks

  • I'm having the same error pop up, but I want to use Impersonation. I'm running an ASP.NET 3.5 site on IIS7 connecting to a SQL 2008 db. I have CDC turned on for HIPPA compliance, but the connecting account is the NetworkService which doesn't have access to the db. I want the connecting SQL account to be the account used to log onto the web site. ie. If I log onto the site as domain\user, then access to the db should be as domain\user so the audit information is correct. But it's trying to connect as NetworkService which the apppool is runing as. DO you know of any information that would point me in the proper location to fix this lil issue. Thanks in advance.

  • The default is NetworkService, however, none of my websites with connections to SQL Server 2008 work with that user. I can connect to my SQL Server 2000 database with NetworkService, but not SQL Server 2008.

    In a more recent post, a user says never to use the dbo user for this. However, I too am looking to find a solution that works that does not use the dbo.

  • See this URL for other comments by readers:
    http://weblogs.asp.net/nannettethacker/archive/2010/10/12/fix-for-login-failed-for-user-nt-authority-anonymous-logon.aspx

  • I just want to say thank you because I spent the last 12 hours trying to solve the problem.

    You are a life saver!

Comments have been disabled for this content.