ClickOne Publishing/Web Application debugging from Visual Studio on Windows Vista

If you haven't experienced Windows Vista yet, it is a very cool operating system, but there are a lot of lessons to learn in getting up to speed in working in the new environment.
The biggest thing to get used to if you haven't been running a non-admin account on your XP machine is that there are probably a hundred things or more that you get away with that you don't even know that the reason you get away with it is that you are an admin.
In Vista, even when logged in with an administrator account, you are still not allowed to do administrator things without a privilege elevation through a mechanism called User Access Control (UAC). UAC will seem like a living hell at first because all kinds of things will stop working for you. For example, if you are only getting to some files because you are an admin, and an app such as Quicken tries to run and access those files, you will just get whatever kind of error the app vendor decided to surface for a file I/O error. However, the best way to approach it is to treat it as a learning experience to figure out how to avoid running things as admin unless you really need to (i.e. give your user account permissions to the directories you really need, don't rely on Admin privilege to give you access).
Another example is when publishing with ClickOnce. When you publish from Visual Studio to an http address, VS uses Frontpage Server Extensions (FPE) to create the virtual directory and copy the files to it. First step on Windows Vista is that you need to have IIS 6 Compatibility enabled (it is not on by default, nor is IIS installed by default like XP). Once you do that, IIS 7 knows how to look like a Frontpage Server Extension endpoint. The other thing is that you can only access the web server through FPE if you are accessing as an admin from VS.
Even when logged in as an admin, VS will not be running with admin privilege by default. As a result, when you try to publish a ClickOnce app you will get an obscure error that says that FPE is not installed on the server. Specifically:
"Failed to connect to 'http://localhost/WindowsApplication3/' with the following error: Unable to create the Web 'http://localhost/WindowsApplication3/'. The Web server does not appear to have the FrontPage server extensions installed."
The solution is quite simple: you need to run VS as an admin. To do this, you can right click on the shortcut to VS from the start menu and select Run as Administrator.
If you want to always run VS as admin, do the following:


• Go to devenv.exe in the C:\Program Files\Microsoft Visual Studio 8\Common7\IDE directory.
• Right click and go to properties.
• Select the Compatibility tab.

• Check the box at the bottom that says Run this program as an administrator (see below).

The new security protections of UAC are there for a reason. You could just turn it off and you wouldn't have problems like this in the first place. I'd encourage you not to do that. Use it as a tool to teach you how to get your work done without admin privilege to the extent possible. So in this case I prefer to only run VS as an admin when I need to by doing the right click - Run as Administrator option instead of always enabling it, but you will have to make these productivity vs security decisions for yourself.

1 comment:

indiroma said...

ITSolusenz departments manage all components web application, software development including, Application Development Company, software development company india, Software Development Services.