How to edit Firewall rules in code successfully on a Worker Role Instance?

谁说我不能喝 提交于 2019-12-04 16:08:18
Adam Heeg

I found over on the azure forums that I need to enable my Worker Role to run with elevated privileges. This can be done in the ServiceDefinition.csdef file by adding the following attribute to the WorkerRole element

<WorkerRole name="CloudService.Worker" vmsize="ExtraSmall"
            enableNativeCodeExecution="true">

and also by adding a

<Runtime executionContext="elevated" />

element inside the WorkerRole element.

Both sets of code ran successfully with the configuration changes.

I've found an interesting post in msdn blogs that uses a library which simplify the configuration of firewall rule, may be it will resolve your issue,

http://blogs.msdn.com/b/securitytools/archive/2009/08/21/automating-windows-firewall-settings-with-c.aspx

on a

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