【问题标题】:Convert folder under virtual directory to Application, using WIX使用 WIX 将虚拟目录下的文件夹转换为应用程序
【发布时间】:2012-01-16 11:05:14
【问题描述】:

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

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

【问题讨论】:

    标签: iis wix


    【解决方案1】:

    我找不到通过 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}"
    

    【讨论】:

    • 您能发布此信息的来源吗?特别是对于 IIS6。谢谢!
    【解决方案2】:

    这可以通过IISExtension 来完成,正如 Daniel Morritt 所建议的那样。因为很难找到示例代码,所以我想我会发布我是如何做到的。

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

    以上所有内容都可以嵌套在&lt;Fragment&gt; 元素中。

    【讨论】:

      【解决方案3】:

      您可以在您的项目中添加对 WiX IISExtension 的引用并使用它创建一个。

      可以在这里找到一个很好的例子:Using WiX to create an IIS virtual directory

      【讨论】:

      • 现有Sentry虚拟目录就是这样创建的,不适用于在现有虚拟目录下创建应用(注意iis:WebVirtualDir的'Website'属性)
      【解决方案4】:

      我已经测试过这种方法,它很有效:

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

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

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

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2013-02-19
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2011-02-26
        • 1970-01-01
        相关资源
        最近更新 更多