WiX Installer: how to add Firewall exception rule?

亡梦爱人 提交于 2019-12-11 06:11:35

问题


I install my windows service using WiX installer. It adds Firewall exception:

<File Id="file_1000_" Checksum="yes" Vital="yes" KeyPath="yes" Source="$(var.SourceFiles)\MyService.exe">
<fwrules:FirewallException Id="FirewallDomainMySvcTCP"
Name="My Service Domain TCP"
Protocol="tcp"
Port="[PORTNUMBER]"
Scope="any"
IgnoreFailure="yes"
Profile="domain" />

My service is a windows host for a few WCF services.

Then I run a query from other workstation to the service, it cannot connect. I go to Control Panel->Firewall->Advanced->Inbound Rules and see the rule exists but on "Program and services" it has a "This program: " When I mark "All programs that meet the specified conditions" my client connects to the service and works fine.

How I can add in my Installer the Firewall exception rule which is for "All programs that meet the specified conditions" but not for one exe?


回答1:


Solved:

The elements

should be under Component but not under File. I moved them on one level upper. Like this: (check the 1st message: "Component" instead of "File")

  <Component Id="comp_000011" Guid="guid">
  <fwrules:FirewallException Id="FirewallDomainMySvcTCP"
    Name="My Service Domain TCP"
    Protocol="tcp"
    Port="[PORTNUMBER]"
    Scope="any"
    IgnoreFailure="yes"
    Profile="domain" />


来源:https://stackoverflow.com/questions/45591000/wix-installer-how-to-add-firewall-exception-rule

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!