Why do IIS authentication settings change when I overwrite my published files?

508 Views Asked by At

Here is the procedure I go through to publish an application to our IIS server.

  1. From VS2013, click Build->Publish MyApp (I publish to a share on our file server)
  2. Copy and replace MyApp's containing folders/files from the file share to the project folder (C:\inetpub\wwwroot\MyApp) on the IIS server.

I set the authentication configuration through IIS Manager. Before copying any files the only authentication enabled is anonymous. After copying it enables ASP.NET Impersonation. I have noticed that this only happens if I replace the web.config file.

Is there a better procedure to publishing an app to IIS so that my IIS settings do not change? Now that I know it is changing settings in the background I am concerned that it is changing other things that I just have not noticed yet.

1

There are 1 best solutions below

0
CarltonF On

Many of the settings that you see in the IIS Manager console are derived from the web.config that you deploy, and any changes you make will be written to the web.config on the server.

However, when you redeploy your web.config to the server, it will overwrite anything you have updated through the console.

To solve this, add the setting you require in the web.config in your source repo (or where you deploy from):

<configuration>
  <system.web>
    <identity impersonate="false" />
  </system.web>
</configuration>