I get a warning like this in the immediate window when FirewallManager.Instance.Rules.SingleOrDefault is executed.
I use VS2022 with C# Desktop with Framework 7.0.
The program works fine but a warning appears like that. Can it be ignored?
Thanks.
Exception thrown: 'System.Runtime.InteropServices.COMException' in System.Private.CoreLib.dll
Exception thrown: 'System.Runtime.InteropServices.COMException' in WindowsFirewallHelper.dll
Exception thrown: 'System.NotSupportedException' in WindowsFirewallHelper.dll
Exception thrown: 'System.Runtime.InteropServices.COMException' in System.Private.CoreLib.dll
Exception thrown: 'System.Runtime.InteropServices.COMException' in WindowsFirewallHelper.dll
Exception thrown: 'System.NotSupportedException' in WindowsFirewallHelper.dll
var wcfHttpRuleInName = String.Format("DiscountCard - WcfHttpRuleIn: Port {0} - Protocol {1}", Settings.Default.ServiceHttpPort, FirewallProtocol.Any);
var wcfHttpRuleAction = FirewallAction.Allow;
var wcfHttpRulePort = (ushort)Settings.Default.ServiceHttpPort;
var wcfHttpRuleProtocol = FirewallProtocol.Any;
//
var isWcfHttpRuleInNameFounded = FirewallManager.Instance.Rules.SingleOrDefault(r => r.Name.Equals(wcfHttpRuleInName));
if (isWcfHttpRuleInNameFounded == null)
{
var ruleIn = FirewallManager.Instance.CreatePortRule(
wcfHttpRuleInName,
wcfHttpRuleAction,
wcfHttpRulePort,
wcfHttpRuleProtocol
);
ruleIn.Direction = FirewallDirection.Inbound;
FirewallManager.Instance.Rules.Add(ruleIn);
}
I get a warning like this in the immediate window when FirewallManager.Instance.Rules.SingleOrDefault is executed.
I use VS2022 with C# Desktop with Framework 7.0. The program works fine but a warning appears like that. Can it be ignored?
Thanks.