6

I'm developing an ASP.NET MVC 4 site using Visual Studio 2012 Premium on Windows 8 RTM x64. When I right click on the web application and choose Publish, Visual Studio 2012 returns the message:

"fail to open url of 'http://.../'. Exception:Class not registered"

The publish process seems to work correctly but it fails to launch the browser. This happens every time I try to Publish the site and it happens with Chrome (21.0.1180.79 m) or Firefox (14.0.1).

Furthermore, since the site isn't launching post Publish, I do it manually using Ctrl-F5. I'm able to navigate around the site normally, but if I right click on the browser's icon on the task bar to launch another browser instance, nothing happens. Once I close all browser instances, the browser task bar icon reverts to its normal behavior.

I'm not sure if these two issues are related, but the common theme here is launching a browser from Visual Studio 2012 causes unexpected side effects. The browser either fails to launch on Publish or launches with Ctrl-F5 but renders launching another instance useless using the task bar icon.

Any help is appreciated.

EDIT: I've re-installed the entire software stack (Windows 8, Office 2010, Visual Studio 2012, Windows Update, Chrome, Firefox). The above issues continue, unless I make Internet Explorer the default browser.

Thanks.

Rudy
  • 920
  • 9
  • 19
  • I am experiencing the same issue. My setup is the same as yours. – Chuck Conway Aug 21 '12 at 04:44
  • the code uses Process.Start so there's something wrong with Firefox or Chrome registering. Try setting all their defaults with the Default Programs Control Panel? – Scott Hanselman Aug 21 '12 at 19:33
  • Are you running as Admin? Try "start "http://Hanselman.com"" from a CMD prompt and a an admin prompt. – Scott Hanselman Aug 21 '12 at 20:03
  • My user is in the Administrators group. I launch VS 2012 from a shortcut set to Run as administrator. However, as soon as I remove the Run as administrator setting on the shortcut, this issue disappears. What's the correct way to launch VS 2012? – Rudy Aug 21 '12 at 20:33
  • I noticed that you will receive the error if you run VS as an admin. I have filed a bug internally for this. If you want to avoid the error you can just get rid of the Destination URL, its only used to open the browser. – Sayed Ibrahim Hashimi Aug 21 '12 at 21:32
  • @ScottHanselman: I'm seeing the same issue, happens only in Chrome, only under admin. Also, I think you meant `start http://hanselman.com` so you exercise the `http` registered handler. – DeepSpace101 Oct 24 '12 at 20:39

2 Answers2

4

I filed a Chrome bug, it was a browser registration thing. If you uninstall and reinstall from a Download and be SURE to say Yes to the UAC prompt, Chrome will register Machine Wide, rather than User. That is required to launch as Admin. (HKLM vs. HKCU)

Scott Hanselman
  • 17,712
  • 6
  • 74
  • 89
2

It appears this problem is much more widespread than the Web Publish operation. Anytime you use the ShellExecute() API (or Process.Start) to access a URL it fails when running under elevated rights (ie. Run As Administrator).

I see this in any application that uses Process.Start() or ShellExecute(). When UAC is on and I run it normally under the UAC account everything works and the browser opens. Run with "Run As Administrator" it fails. It's easy to test.

Not sure if this is a bug in the OS, or whether Microsoft deems this as a security 'feature'.

FWIW, some people have mentioned the setting IE as the default browser works, but it doesn't work for me. Basically no links work if I've elevated rights. This has actually broken quite a few administrative applications we use in the back office for administration.

Rick Strahl
  • 17,302
  • 14
  • 89
  • 134