开发者

Programmatically setting IIS6 Wildcard application maps

开发者 https://www.devze.com 2023-03-20 03:42 出处:网络
I\'m currently supporting a build process and I need to set the Wilcard Application maps on an iis6 website.

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 :)

Programmatically setting IIS6 Wildcard application maps


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();


Using the msbuild extension pack you can do:

<MSBuild.ExtensionPack.Web.Iis6VirtualDirectory TaskAction="Create"  Website="site" Name="vdir" Properties="ScriptMaps=*,$(MSBuildToolsPath)\aspnet_isapi.dll,1,All"/>

This will replace all the script maps, not add one.

0

精彩评论

暂无评论...
验证码 换一张
取 消