维克斯+ IIS:在禁用端口 80 绑定的网站上创建虚拟目录
我安装了 Wix,它通过以下方式在 IIS 中创建虚拟目录:
<DirectoryRef Id="INSTALLLOCATION">
<Component Id="VirtualDirectory" Guid="29BEECCC-AA5F-11DF-BBB1-9C0AE0D72085">
<iis:WebVirtualDir Id="MyVDir" Directory="INSTALLLOCATION" Alias="MyVDir" WebSite="DefaultWebSite">
<iis:WebApplication Id="MyApplication" Name="MyVDir" />
</iis:WebVirtualDir>
<CreateFolder />
</Component>
</DirectoryRef>
<iis:WebSite Id="DefaultWebSite" Description="Default Web Site">
<iis:WebAddress Id="AllUnassigned" Port="80" />
</iis:WebSite>
但是,如果已删除该网站的端口 80 绑定,则此操作会失败。
元素和 Port
属性都是强制性的,但在这种情况下完全是多余的 - 我不关心网站的端口是什么是的,只要它创建我的虚拟目录!
有没有办法让上述安装程序成功创建虚拟目录而不提示用户输入端口号?
I have a Wix installed which creates a virtual directory in IIS via the following:
<DirectoryRef Id="INSTALLLOCATION">
<Component Id="VirtualDirectory" Guid="29BEECCC-AA5F-11DF-BBB1-9C0AE0D72085">
<iis:WebVirtualDir Id="MyVDir" Directory="INSTALLLOCATION" Alias="MyVDir" WebSite="DefaultWebSite">
<iis:WebApplication Id="MyApplication" Name="MyVDir" />
</iis:WebVirtualDir>
<CreateFolder />
</Component>
</DirectoryRef>
<iis:WebSite Id="DefaultWebSite" Description="Default Web Site">
<iis:WebAddress Id="AllUnassigned" Port="80" />
</iis:WebSite>
However this fails if the bindings for port 80 have been removed for that web site.
The <iis:WebAddress />
element and Port
attributes are both mandatory, however completely superfluous in this case - I don't care what the Port of the web site is, as long as it creates my virtual directory!
Is there any way of getting the above installer to successfully create a virtual directory without prompting the user for a port number?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
所有虚拟目录都植根于网站。如果 WebSite 元素位于 Component 元素下,则 WebSite 元素可用于创建网站;如果不在 Component 元素下,则可用于查找网站。 VirtualDir 元素必须以某种方式引用 WebSite 元素。这就是 IIS 的设计,因此 WiX 也以这种方式建模。
注意:有人可能会认为不在 Component 元素下的 WebSite 元素应该被命名为“WebSiteSearch”或其他名称。
All virtual directories are rooted in a web site. The WebSite element can be used to create a web site if WebSite element is under Component element or used to find a web site if not. The VirtualDir element must refer to a WebSite element somehow. That's the design of IIS thus the WiX models this way.
Note: One might argue that WebSite element not under a Component element should have been named "WebSiteSearch" or something.
我发现只要提供了
SiteId
属性,端口实际上就会被忽略。因此,我的问题的解决方案是将我的WebSite
元素更改为:请注意,
Port
属性仍然是必需的(并且不能为 0),但是即使SiteId
属性为*
(表示描述用于识别站点)。有关详细信息,请参阅WebSite 元素(WiX 文档)。
I've found that as long as the
SiteId
attribute is provided the port is in fact ignored. The solution to my problem was to therefore change myWebSite
element to be:Note that the
Port
attribute is still required (and cannot be 0), however is ignored even if theSiteId
attribute is*
(meaning that the description is used to identify the site).See WebSite Element (WiX documentation) for more information.