Saturday, May 25, 2013

Visual Studio 2008 – ASP.NET “System.Runtime.InteropServices.COMException”


The Issue
When opening an existing ASP.NET project for the first time in Visual Studio 2008 it returns
the error “System.Runtime.InteropServices.COMException” without any HRESULT code.
The problem I experienced was specifically on a Windows 7 machine,

but the same solutions should work on Vista as well.




Multiple Issues / Multiple Solutions
There are three issue at play here, caused by the project being configured to use IIS as its web server as opposed to using the built in Visual Studio Development Server. Before the solutions, first make sure IIS is installed on the computer.
If you do not have IIS or you do not want to use IIS open the project file in notepad and change the <UseIIS> tag from True to False.
Once you have IIS on the computer and Visual Studio is still displaying this error, continue with the following solutions.Web Application URLFor Visual Studio to load the project its URL must exist in IIS. If it does not, you need to Create a WebApplication in IIS. If you don’t know the application’s URL, open the project file in notepad and find the <IISUrl> tag.

IIS 6 WMI Compatibility – If this is the first time opening your project in IIS7 the project may require IIS 6 WMI Compatability to be installed.




1.Open the Windows Control Panel (Start Menu -> Control Panel)
2.Select Programs and Features
3.On the left side click on Turn windows features on and off
4.Check the “IIS 6 WMI Compatibility” and “IIS Metabase and IIS 6 Configuration Compatability” options
5.Click OK

    Administrator – Visual Studio has to be “run as administrator” to acccess IIS applications,
     in Windows Vista and Windows 7. This is true even if you are logged into the computer as an Administrator.

    To run as an administrator, right click the Visual Studio shortcut and select “Run as Administrator”


    You can also setup Visual Studio to always run as Administrator
    • ·         Right click the Visual Studio shortcut.
    • ·         Select properties
    • ·         Click the advanced button
    • ·         Check “Run as Administrator”.
    • ·         Click OK




    Hope You Have Enjoyed This Artical.