Question

I finally have TeamCity setup to build on Source Control changes, and a separate MSBuild task setup to package and deploy to IIS on the staging server using the 'package' target and the generated 'deploy.cmd' script. Everything is perfect in terms of build events, file inclusion/exclusion, etc...

However, I've come across a problem with how the package is being deployed. Whenever I deploy the package to the server, the IIS settings get blown away. For example, I can set cache expiration headers or turn on static compression, and after I deploy my package they will revert to the default values of the server.

Does anyone know how I can get around this? Is there a parameter I can pass or rule I can ignore?

Was it helpful?

Solution

I think what you are running into is different from what you might think.

In IIS 7 when you set the values for properties like you are describing the configuration for that is stored in the web.config for the application, and not applicationHost.config. For example I just created a site and modified those settings, then inside my web.config file the following fragment was dropped in.

<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<modules runAllManagedModulesForAllRequests="true" />
    <urlCompression doStaticCompression="false" />
    <caching>
        <profiles>
            <add extension=".aspx" policy="CacheUntilChange" kernelCachePolicy="DontCache" />
        </profiles>
    </caching>
</system.webServer>

So what is happening when you perform a sync the web.config in your package is overwriting the web.config which has the modified properties in it. What you need to do to configure your application in IIS 7 as you want it, then grab the node from place it in your web.config file. Alternatively if you want you can place it in either web.debug.config or web.release.config if you want to only have that in your web.config when publishing.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top