WCF Service Hosting in Vista

I put together a small WCF service in VS2008, and when I try to start the host using the HTTP protocol, it bombs because it does not have the appropriate rights. On my line "Host.Open ()" I get this exception: " HTTP was unable to register the URL http: // +: 9001 / . Does not have permission to access this namespace ." I did not have this problem using TCP. My o / s is Vista Home Premium.

This happened when I tried to debug it inside VS2008. After many studies, I decided that I could make the host work by building by going to the bin folder and right-clicking on my executable file, choosing Run as administrator. The same thing happened when I tried to use WcfSvcHost.exe. I had to open the VS2008 command prompt window from my menu using "Run as administrator" before I could successfully start WcfSvcHost to start my service.

Is there a way to do this correctly instead of using this workaround? Will I have similar problems when I try to deploy this next week on Windows 2003 Server?

+4
source share
4 answers

This link may help you: http://msdn.microsoft.com/en-us/library/ms733768.aspx

Short version: pre-register URL / namespace from privileged console

netsh http add urlacl url = http: // +: 9001 / user = DOMAIN \ user

+7
source

Make sure you run VS as an administrator.

+2
source

Locally, you can change your base address something like this:

<host> <baseAddresses> <add baseAddress="http://localhost:8731/Design_Time_Addresses/MyService/" /> </baseAddresses> </host> 

The main part is the addition of "Design _ Time _ Addresses". If you create a WCF Services Library project, it by default sets App.config for this project. Everything works fine, but if you delete "Design _ Time _ Addresses" and try to run it using http: // localhost: 8731 / MyService / ", you will get the error you're working with.

+1
source

I had a similar problem:

WCF Service Error HostHttpBinding 503

The netsh command works for Vista, but for the Windows 2003 server there is a utility called HttpCfg.exe that allows you to register the URL / namespace for the account. Not sure if netsh is available in 2003.

I never had to work on Vista, I still get 503 errors when trying to access services. If you run into the same problem / find out it, I would appreciate it if you publish again! Thanks

0
source

All Articles