I wrote a small C# application to do firewall tasks like block IPs, enable/disable the firewall, etc. It works perfectly on Windows 7 x64 but as soon as I try it on Windows Server 2008 x64 it crashes. This is what my code looks like where its crashing...
public partial class frmMain : Form
{
private INetFwMgr FWManager;
public frmMain()
{
InitializeComponent();
Type NetFwMgrType = Type.GetTypeFromProgID("HNetCfg.FwMgr", false);
FWManager = (INetFwMgr)Activator.CreateInstance(NetFwMgrType);
if (getFirewallStatus() == true)
UpdateFirewallStatus(true);
else
UpdateFirewallStatus(false);
ListOpenPorts();
}
}
The error is something along these lines...
Problem Event Name: CLR20r3
Problem Signature 01: brutalnt.exe
Problem Signature 02: 1.0.0.0
Problem Signature 03: 4ed589c8
Problem Signature 04: mscorlib
When I removed the lines to obtain the Firewall Manager, it started up fine. So do I need to obtain it differently in Server 2008?
This was Answered in the comments, but the issue was with the machine's Active Directory installation and a broken Firewall.