Win7 自托管 WCF .net 应用程序的防火墙规则不正确
我的 .net 应用程序中运行着一个自托管 WCF 服务。
当防火墙配置正确时,该服务可以正常工作。但是,应用程序首次运行时添加的默认规则配置不正确,需要用户更改。当该应用程序首次在计算机上运行时,它会显示一个“Windows 安全警报”对话框,其中包含消息“Windows 防火墙已阻止该程序的某些功能”并提示“允许访问”。如果用户选择“允许访问”,则 Windows 会向防火墙添加应用程序例外。
所有上述行为都完全符合预期,并且正是我想要的。
问题是添加到防火墙的规则不正确,无法使WCF服务正常工作。在规则属性的“程序和服务”选项卡上添加的规则“此程序”中列出了我的 WCF 自托管 exe。这对我来说似乎很合适。
但是,如果我将此设置更改为“满足指定条件的所有程序”,则该规则可以正常工作。
所以,我的问题分为两部分。
a) 当我的应用程序正确明确支持流向我的 EXE 的流量时,为什么该规则会阻止流向我的应用程序的流量?
b) 如何解决这个问题?我是否可以更改应用程序中的某些内容,以便在不限制我的 exe 的情况下添加规则或正确允许流量流向我的 exe?
感谢您的帮助。
I have a self hosted WCF service running in my .net App.
The service works fine when the firewall is configured correctly. However, the default rules added when the app first runs are not configured correctly and require changes by the user. When the app first runs on a machine it presents a "Windows Security Alert" dialog with the message "Windows Firewall has blocked some features of this program" and prompts to "Allow Access". If the user selects "Allow Access" then windows adds an Application exception to the firewall.
All of the above behavior is exactly as expected and is just what I want.
The problem is that the rule added to the firewall is not correct and does not enable the WCF service to work correctly. In the added rule "This Program" on the "Programs and Services" tab of the rule properties lists my WCF self hosted exe. This seems appropriate to me.
However, if I change this setting to "All programs that meet the specified conditions" then the rule works fine.
So, my question is in two parts.
a) Why is traffic to my app blocked by this rule when it correctly explicitly supports traffic to my EXE?
b) How do I fix the problem? Can I change something in the app so the rule will be added without restriction to my exe or to correctly allow traffic to my exe?
Thanks for your help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
a) 因为它不是您的 exe,而是接受入站调用的 WCF 守护进程,通过指定任何进程,您所说的将侦听端口 XXX 的“任何进程”将被添加到例外列表中。因此,守护进程被添加到异常列表中。
b) 您可以将 wcf 守护进程添加到例外列表,或者将您的 exe 端口添加到例外列表。
如果您使用 net.tcp 绑定,则守护进程为 $frameworkDir/SMSvcHost.exe
a) because it is not your exe but the WCF daemon process taking inbound calls, by specifying any process, you are saying "any process" that would listen on port XXX will be added to exception list. Thus, the deamon process is added to exception list.
b)you can either add wcf daemon process to exception list , or add your exe's port to exception list.
In case you are using net.tcp binding, deamon porcess is $frameworkDir/SMSvcHost.exe