Lions Den

The Code and Times of Hanan Schwartzberg

About Hanan | Hanan's CV | Contact Hanan

October 19, 2010

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

Filed under: ASP.NET,IIS7 — Tags: , — Hanan Schwartzberg @ 4:01 pm

The Issue

When openning 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 specificly on a Windows 7 machine, but the same solutions should work on Vista as well.

System.Runtime.InteropServices.COMException

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 URL For Visual Studio to load the project its URL must exist in IIS. If it does not, you need to Create a Web Application 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.

Install IIS 6 WMI Compatibility

  • Open the Windows Control Panel (Start Menu -> Control Panel)
  • Select Programs and Features
  • On the left side click on Turn windows features on and off
  • Check the “IIS 6 WMI Compatibility” and “IIS Metabase and IIS 6 Configuration Compatability” options
  • 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

Visual Studio Shortcut - Advanced Options

3 Comments »

  1. Thank you so much! IIS 6 WMI Compatibility wasn’t included by default when I installed IIS7, so I added that first. That didn’t fix it, so I set my VS shortcut to run as Administrator, and that worked. For some reason I didn’t need to do that in my install of 32-bit Windows 7, but I do in 64-bit Windows 7.

    Comment by Tyson — March 30, 2011 @ 8:55 pm

  2. Grt stuff :) really saved my time…

    Comment by vignesh — April 27, 2011 @ 6:38 am

  3. Thank you so much for this enormous help :)

    Comment by Armin — August 16, 2012 @ 5:06 pm

RSS feed for comments on this post. TrackBack URL

Leave a comment

Anti-Spam by WP-SpamShield

Home | Site Design | Banner Design | Code Den | Offsite Posts | Downloads | Photography | About Hanan | Hanan's CV | Contact Hanan
Copyright © 2009 Hanan Schwartzberg. All rights reserved.