Search code examples
asp.netdeploymentmsbuildiis-6

Programmatically setting IIS6 Wildcard application maps


I'm currently supporting a build process and I need to set the Wilcard Application maps on an iis6 website.

I currently utilise a mixture of the SDC tasks And the MSBuild Extension pack to do various things but I have come upon a brick wall when trying to set Wildcard Application Maps using these two frameworks.

perhaps I've just missed it in the documentation but I wondered if anyone knew how to set these.

To be clear here is where you would set these in the gui:

I am open to alternative methods of setting this including perhaps writing some code to do it if neccessary :)

ApplicationMaps


Solution

  • If you use Wix, you can add those by using WixIISExtensions:

    <iis:WebApplicationExtension CheckPath="no"
             Script="yes"
             Executable="[FRAMEWORKROOT]v2.0.50727\aspnet_isapi.dll"
             Verbs="GET,HEAD,POST"/>
    

    Also, as suggested in this post, try:

    String strPath = "IIS://localhost/W3SVC/1/Root";
    DirectoryEntry IISEntry = new DirectoryEntry(strPath);
    PropertyValueCollection applicationMappings = IISEntry.Properties["ScriptMaps"];
    applicationMappings.Add(@",%Windir%\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll,4,All");
    IISEntry.CommitChanges();