Windows user in IIS

2

I'm trying to log on to a SQL Server 2008 database, with the windows user accessing my published site in IIS.

I've configured Web.Config for windows authentication, set up the application pool, leaving identificador equal AplicationPoolIdentity .

When accessing the site I can get the correct user by the command WindowsIdentity.GetCurrent() . But when trying to connect to the database is returning the following error Login failed for user 'dominio\desenvolvedor1$'. being developer1 is my machine name and not the user that is in windows.

A Connection String is Data Source=vc9;Initial Catalog=sgt;Integrated Security=SSPI;Application Name='Controle de Sprint';Pooling=False;

If the user logs directly into the database via Sql Management,

Here's how the IIS access permissions are configured

    
asked by anonymous 04.05.2016 / 14:43

1 answer

1

According to the configuration that you put in the question it seems that you have to configure "impersonate = true" in your web.config.

Place the following code snippet.

<configuration>
  <system.web>
    <identity impersonate="true"/>
  </system.web>
</configuration>
The "impersonate = true" is the bridge for the ISS to use the authenticated user account in access to external resources (SQL, File System, etc ...)

See more details at: link

NOTE: Verify that giving SQL access to user logins is optimal in your solution. With this type of permission, a user who knows the address of the database can access it directly (via SQL Management Studio).

    
09.09.2016 / 18:13