2

I've noticed that when I deploy my application via msdeploy all of the url re-writes (IIS 7.5) are removed. How can I prevent this from happending or how can I build the url re-write into part of the msdeploy script?

1

Ok, I just wasn't thinking straight. I don't actually have to do anything with MSDeploy. The settings that I create in the IIS manager are simply dumped straight into my applications root web.config. Deploying the new config files always overwrites what I'd set in IIS. The solution is to put the redirects into the web.config and deploy that.

For example:

<system.webServer>
    <rewrite>
        <rules>
            <rule name="weddings1" stopProcessing="true">
                <match url="weddings.html" />
                <action type="Redirect" url="weddings" />
            </rule>
        </rules>
    </rewrite>
</system.webServer>
1
  • You're right. IIS7's distributed configuration model is great in many ways, but has the gotcha of this situation. As you suggested, adding to source control will take care of it. You can set the rule in your applicationHost.config file too if you want, but you need to do it manually since IIS Manager will default to placing it in the site's web.config file. – Scott Forsyth - MVP Apr 11 '11 at 19:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.