I recently bought a new laptop with Windows Vista already pre-installed. Until that time my development machine was running on XP, but now I had the joy of meeting the latest invention (??) of Microsoft called User Access Control (UAC)! I am still figuring out if this is supposed to be feature or a bug that the programmers could not fix.
My problem is the following: Whenever I open a perfectly working solution on my new machine I got an annoying "System.Runtime.InteropServices.COMException" exception hitting me. I quickly realized it happened only when accessing a Web or Service through IIS. Whenever you want to access local IIS Website your Visual Studio needs to fired up in the context of an administrator, by default Vista starts applications in a limited-privilege user account. The solution to this problems is relatively easy, always start your studio in administrator mode. I created a new shortcut that runs in administrator mode and associated my sln-files to use this shortcut by default. If you right-click on a shortcut, in the advanced tab you can select the 'run in administrator' option.
Problem solved if you can live with a UAC popup every time you open Visual Studio. If you anything like me you want to avoid this popup as well :-), my first thought was simply disable the UAC Altogether, but then other features might stop working because windows believes your system is not trustworthy. Since I usually select proceed in those useless popups I decided to accept this silently without prompting, you can read here how this can be achieved. I took the liberty of giving you summary here:
Click Start and Control Panel. Switch to Classic View (if you haven't already) and click on the Administration Tools icon. In the list that opens click on Local Security Policy, and in the next window, Local Policies (a tiny bit redundant, but all UIs can't be perfect -- If UAC is running you'll get a UAC pop-up somewhere in here). In the Local Policies list click Security Options, and scroll down to "User Account Control: Behavior" (the full title of the policy is "User Account Control: Behavior of the elevation prompt for administrators in Admin Approval Mode" but the window barely opens that far). Double-click the title and in the dialog box change its setting from "Prompt for Consent" to "Elevate without prompting." Click OK and the urge to tear your hair and scream at your PC will be greatly diminished in the future.
I hope this post will save you time and headache, till next time.