User will have this dialog if my project is run for the first time:
How to make my project communicating in private networks without the user's request?
I only have tried to code as in an example:
var rule = FirewallManager.Instance.CreateApplicationRule( @"MyApp Rule", FirewallAction.Allow, @"C:\MyApp.exe" ); rule.Direction = FirewallDirection.Outbound; FirewallManager.Instance.Rules.Add(rule);
But I get an exception UnauthorizedAccessException in the last row:
System.UnauthorizedAccessException: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
at WindowsFirewallHelper.COMInterop.INetFwRules.Add(INetFwRule rule)
at WindowsFirewallHelper.Collections.FirewallWASRulesCollection'1.InternalAdd(INetFwRule native)
at WindowsFirewallHelper.InternalHelpers.Collections.ComCollectionBase'4.Add(TManaged item)
User will have this dialog if my project is run for the first time: How to make my project communicating in private networks without the user's request? I only have tried to code as in an example:
var rule = FirewallManager.Instance.CreateApplicationRule( @"MyApp Rule", FirewallAction.Allow, @"C:\MyApp.exe" ); rule.Direction = FirewallDirection.Outbound; FirewallManager.Instance.Rules.Add(rule);
But I get an exception UnauthorizedAccessException in the last row: System.UnauthorizedAccessException: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)) at WindowsFirewallHelper.COMInterop.INetFwRules.Add(INetFwRule rule) at WindowsFirewallHelper.Collections.FirewallWASRulesCollection'1.InternalAdd(INetFwRule native) at WindowsFirewallHelper.InternalHelpers.Collections.ComCollectionBase'4.Add(TManaged item)