通过防火墙为Windows服务添加端口 [英] Add a port for a windows service through firewall

查看:86
本文介绍了通过防火墙为Windows服务添加端口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我要求使用专用端口进行Windows服务。端口将被命名为7770.Post安装我想要通过c#中的代码将此Windows服务添加到防火墙,并且还必须将专用端口注册到此Windows服务。用户将通过Internet访问此服务。我知道如何向防火墙添加新规则以打开端口并添加它to globalopenports但我不知道的是在打开这个专用端口之后如何为我的Windows服务保留这个端口。我希望通过C#实现这一点。我想在After_Install事件中编写我的逻辑来实现所有这些.I我不确定是否需要在使用FirewallApi.dll或ApplicationName或两者添加新规则时设置ServiceName属性。帮助。

解决方案

Let1假设,你想要将例外添加到Windows防火墙,而不是例如Cisco 6500。这很可能对您有所帮助: http :/ // hlog =。 msdn.com/b/securitytools/archive/2009/08/21/automating-windows-firewall-settings-with-c.aspx\"target =_ blanktitle =新窗口> ^ ]

Hi All,

I have a requirement for using a dedicated port for a windows service.The port will be given say ,7770.Post installation I want to add this windows service to the firewall through code in c# and also it has to register the dedicated port to this windows service.Users will access this service over internet.I know how add a new rule to firewall also to open a port and add it to globallyopenports but what I don't know is after opening this dedicated port how to reserve this port for my windows service only .All this I wish to achieve through C#.I want to write my logic to achieve all this in After_Install event.I am not sure whether I need to set the ServiceName property in adding a new rule using FirewallApi.dll or ApplicationName or both.Kindly help.

解决方案

Let1's assume, you want to add the exception to windows firewall, and not to a Cisco 6500 for example. This will most likely help you: http://blogs.msdn.com/b/securitytools/archive/2009/08/21/automating-windows-firewall-settings-with-c.aspx[^]


这篇关于通过防火墙为Windows服务添加端口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆