我是Wix安装程序的新手。我正在尝试为我的程序添加防火墙例外。
我的代码如下:
<Component Id="_VIEW.EXE" Guid="*" Transitive="yes">
<File Id="view.exe"
Name="view.exe"
KeyPath="yes"
Source="$(var.INSTALLSOURCE)\view.exe">
<fire:FirewallException Id="view_firewall_domain_tcp"
Name="View"
Protocol="tcp"
Scope="any"
IgnoreFailure="yes"
Profile="domain" />
<fire:FirewallException Id="view_firewall_domain_udp"
Name="View"
Protocol="udp"
Scope="any"
IgnoreFailure="yes"
Profile="domain" />
<fire:FirewallException Id="view_firewall_private_tcp"
Name="View"
Protocol="tcp"
Scope="any"
IgnoreFailure="yes"
Profile="private" />
<fire:FirewallException Id="view_firewall_private_udp"
Name="View"
Protocol="udp"
Scope="any"
IgnoreFailure="yes"
Profile="private" />
</File>
</Component>
在我的代码中,我添加了4个防火墙例外,每个例外的"配置文件(Profile)"和"协议(Protocol)"属性都有不同的值。我的期望结果是创建4个例外。
NAME GROUP Profile Enabled Action Override Program Local Address Remote Address Protocol Local Port Remote Port Allowed Users Allowed Computers
view Domain Yes Allow No c:\test\view.exe Any Any TCP Any Any Any Any
view Domain Yes Allow No c:\test\view.exe Any Any UDP Any Any Any Any
view Private Yes Allow No c:\test\view.exe Any Any TCP Any Any Any Any
view Private Yes Allow No c:\test\view.exe Any Any UDP Any Any Any Any
但实际结果只创建了一个异常,并且“Protocol”属性的值为“any”,而不是“TCP”或“UDP”:
NAME GROUP Profile Enabled Action Override Program Local Address Remote Address Protocol Local Port Remote Port Allowed Users Allowed Computers
view Domain Yes Allow No c:\test\view.exe Any Any Any Any Any Any Any
所以,我有两个问题:
- 为什么只创建一个异常?异常的名称必须唯一吗?
- 为什么“Protocol”属性的值没有生效?
我参考了一个关于防火墙扩展的官方文档: http://wixtoolset.org/documentation/manual/v3/xsd/firewall/firewallexception.html 在这个文档中,我看到了一些关于“File”属性的描述:
文件标识符,用于授予对所有传入端口和协议的访问权限。如果使用File,则不能使用Program。 如果在同一FirewallException元素中同时使用File、Port或Protocol,则该异常将无法在Windows XP和Windows Server 2003上安装。可以使用IgnoreFailure="yes"来忽略结果失败,但是该异常将不会被添加。
这是否意味着,如果我为一个程序设置防火墙规则,即使我设置了“Protocol”,“Protocol”和“Port”属性也会自动变成“Any”?