I'm using Web Deploy (from VS2013) to publish an ASP.NET MVC site to an IIS 7.5.
I added some URL rewrite rules and custom HTTP response headers through IIS manager.
The problem is everytime I deploy a new version of the site, this extra configuration is deleted.
Is this the expected behaviour or is there something wrong? How can I keep these custom settings on each deploy?
UPDATE
So I understood I need to put these changes in the web.config
. I'm trying to put them in the Web.Release.config
but it's not being added to the deployed web.config
. I guess I'm missing some XDT:Transform
rule.
This is what I got in my Web.Release.config
(yes, the publishing profile is using this Release config).
<configuration>
<!-- some other stuff -->
<system.webServer>
<rewrite>
<rules>
<rule name="Redirect to www" patternSyntax="Wildcard" stopProcessing="true">
<match url="*" />
<conditions>
<add input="{HTTP_HOST}" pattern="mydomain.com" />
</conditions>
<action type="Redirect" url="http://www.mydomain.com/{R:0}" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>