Search code examples
asp.netwpfiiswcf-data-servicessql-server-2012-express

Can't get rid off "Login failed for user IIS APPPOOL\NETWORKSERVICE"


I'm trying to access a sql server database from an ASP NET app configured to work with IIS.

I have several questions now,

1) Authentication in IIS: I need to know if my authentication settings for the site are ok:

enter image description here

I tried with Windows Authentication set to Disabled, but the problem continues.

2) Are the settings for the user NT AUTHORITY\Sericio de red well configured? ("Servicio de red" means Network Service)

enter image description here

3) When I added the login for network service, I only found "Servicio de red", I guess it's the equivalent for NetworkService, I'm I right?, My windows 7 ultimate is an spanish version, I just changed the windows interface by using a windows upgrade to make it appear in english. Is there a problem with it?, I guess it's right because the access to the database is being done through the IIS APPPOOL\Servicio de red user.

My DefaultAppPool identity is set to to AppPoolIdentity

If you want to see what I have tried, see this thread.

The whole project, along with a backup of the database I'm using can be found here, called MyServiceSolutionInIIS

What I'm trying is to build a WCF Data Service that offers information that comes from an entity data model generated from a sql server database. This service will be used by a WPF App as a client.

I'd like to avoid creating a user for it, I think it can be done with the App Pool


Solution

  • Okay so the way this works is, whatever application pool your endpoint is running under passes its credentials to the SQL Server. So, you have two options:

    1. Run the default application pool under NetworkService, or;
    2. Use SQL Authentication when connecting with your web service to the SQL Server.

    Honestly, the latter is the most common, but in your situation you may be just fine by changing the default application pool to run under NetworkService.