2012-01-16 92 views

回答

8

我無法找到一種方法,通過WIX或IIS擴展要做到這一點,所以我使出調用外部命令。對於未來的參考,命令包括:​​

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}" 
+0

您是否可以發佈此信息的來源?特別是對於IIS6。謝謝 ! – 2017-10-09 05:56:59

1

您可以將參考維克斯IISExtension添加到您的項目,並使用此創建一個。

的一個很好的例子可以在這裏找到:Using WiX to create an IIS virtual directory

+0

就是那樣的現有哨兵虛擬目錄已創建,並且不適用於在現有虛擬目錄下創建應用程序(請注意iis的「網站」屬性:WebVirtualDir) – staterium 2012-01-16 12:31:21

2

氏正如Daniel Morritt所建議的,可以用IISExtension來完成。因爲找到這樣的示例代碼非常困難,我以爲我會發布我是如何做到的。

<!-- 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> 

以上所有可嵌套在<Fragment>元素中。

相關問題