打开防火墙弹出解锁c#应用程序



我想在windows防火墙(Win7/Vista)上解锁我的c#,打开windows安全警报,将防火墙异常添加到例外列表。我使用ServiceHost在控制台应用程序上运行我的WCF服务。

谢谢

使用Netsh AdvFirewall打开您想要的端口或允许程序进出:

查看Netsh AdvFirewall的文档:http://technet.microsoft.com/en-us/library/dd734783 (WS.10) . aspxhttp://support.microsoft.com/kb/947709

一些样品:

启用程序netsh advfirewall firewall add rule name= " My Application " dir=in action=allow program= " C:MyAppMyApp.exe " enable=yes

打开TCP端口16240netsh advfirewall firewall add rule name="MyOpenPort" protocol=TCP dir=out localport=16240 action=allow

最新更新