Hi afsaf2413x-,
>>有谁遇到过这个问题啊,LocalPorts 一赋值端口就报错,说不在预期范围内求帮助*************c# using NetFwTypeLib
请将协议定义在端口之前,并保证有管理员权限。
OutBoundRule.Protocol = 6;//协议号 tcp
OutBoundRule.LocalPorts = "135";//类型为string,写端口就报错,不在预期范围内,注释不用后正常,但是默认把所有端口都禁用了
OutBoundRule.Enabled = true;
Best Regards
Yong Lu
MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to
MSDN Support, feel free to contact MSDNFSF@microsoft.com.