Iis 使用WIX将虚拟目录下的文件夹转换为应用程序

Iis 使用WIX将虚拟目录下的文件夹转换为应用程序,iis,wix,Iis,Wix,如何使用WIX将虚拟目录下的目录转换为应用程序 WIX将以下虚拟目录安装到IIS,我希望它也将webservice文件夹转换为应用程序 您可以在项目中添加对WiX的引用,并使用此选项创建一个WiX引用 这里可以找到一个很好的例子:我找不到通过WIX或IIS扩展来实现这一点的方法,所以我求助于调用外部命令。以下命令供将来参考: IIS 5 C:\Inetpub\AdminScripts\mkwebdir.vbs -c Localhost -w "Default Web Site" -v "sent

如何使用WIX将虚拟目录下的目录转换为应用程序

WIX将以下虚拟目录安装到IIS,我希望它也将webservice文件夹转换为应用程序


您可以在项目中添加对WiX的引用,并使用此选项创建一个WiX引用


这里可以找到一个很好的例子:

我找不到通过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}"
正如丹尼尔·莫瑞特所建议的那个样,这一点可以通过计算机来实现。由于很难找到这方面的示例代码,我想我会发布我是如何做到的

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


以上所有内容都可以嵌套在
元素中。

我已经测试过这种方法,它可以工作:

例如,它说将整个路径放在别名中

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

这是现有Sentry虚拟目录的创建方式,不适用于在现有虚拟目录下创建应用程序(请注意iis的“网站”属性:WebVirtualDir)。您可以发布此信息的来源吗?特别是IIS6。谢谢