Convert folder under virtual directory to application using WIX

How to convert a directory from a virtual directory to an application using WIX?

WIX installs the following virtual directory in IIS, and I want it to also convert the webservice folder to an application.

+6
source share
4 answers

I could not find a way to do this through the WIX or IIS extension, so I resorted to calling an external command. For future reference, the following commands:

IIS 5

C:\Inetpub\AdminScripts\mkwebdir.vbs -c Localhost -w "Default Web Site" -v "sentry/webservice","{physical path}" C:\Inetpub\AdminScripts\adsutil.vbs appcreateinproc w3svc/1/root/sentry/webservice 

IIS 6

 C:\Windows\System32\iisvdir.vbs /create "Default Web Site/Sentry/webservice" webservice "{physical path}" 

IIS 7

 C:\Windows\System32\inetsrv\appcmd add app /site.name:"Default Web Site" /path:/Sentry/webservice /physicalPath:"{physical path}" 
+8
source

This can be done with IISExtension , as Daniel Morritt suggests. Since it is very difficult to find sample code for this, I thought I would post how I did it.

 <!-- Your example uses the default web site. --> <iis:WebSite Id="DefaultWebSite" Description="Default Web Site" SiteId="*"> <iis:WebAddress Id="DefaultWebAddress" Port="80"/> </iis:WebSite> <!-- Web Dir Properties to enable access to a Web Application. --> <iis:WebDirProperties Id="AnonymousExecuteAndScript" Read="yes" Write="no" Execute="yes" Script="yes" AnonymousAccess="yes" Index="no" LogVisits="no"/> <!-- Assumes the presence of this directory reference. --> <DirectoryRef Id="SentryWebServiceDir"> <Component Id="SentryWebServiceComponent" Guid="{GUID-GOES-HERE}"> <iis:WebVirtualDir Id="SentryWebService" DirProperties="AnonymousExecuteAndScript" Alias="Sentry/webservice" Directory="SentryWebServiceDir" WebSite="DefaultWebSite"> <!-- Make this virtual directory a web application --> <iis:WebApplication Id="SentryWebServiceApp" Name="webservice" WebAppPool="DefaultAppPool"/> </iis:WebVirtualDir> <!-- Workaround for the need for a KeyPath for this component. --> <RegistryValue Root="HKLM" Key="SOFTWARE\YourCompany\Sentry\WebService" KeyPath="yes" Value="1" Type="binary" Name="Installed" Id="SentryWebServiceInstalled"/> </Component> </DirectoryRef> 

All of the above can be nested in a <Fragment> element.

+2
source

You can add a link to WiX IISExtension to your project and create it using this.

A good example of this can be found here: Using WiX to create an IIS virtual directory

+1
source

I tested this approach and it works:

http://www.mail-archive.com/ wix-users@lists.sourceforge.net /msg04374.html

It says to put the whole path in an alias, for example

 <iis:WebVirtualDir Id="VIRTDIR_Sentry_webservice" Directory="WebService" Alias="Sentry/webservice" WebSite="SITE_Default"> ... 
0
source

Source: https://habr.com/ru/post/906088/


All Articles