Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hosting a WCF Service in Vista

I put together a small WCF service in VS2008 and when I try to run the host using an HTTP protocol, it bombs because it doesn't have the proper rights to do so. On my "Host.Open()" line I get this exception: "HTTP could not register URL http://+:9001/. Your process does not have access rights to this namespace." I did not seem to have this problem using TCP. My o/s is Vista Home Premium.

This was happening when I would try to Debug it inside VS2008. After a lot of research, I determined I could get the host to run by building, going to the "bin" folder, and right-clicking on my executable, selecting "Run as Administrator". The same thing happened when I tried to use the WcfSvcHost.exe. I had to open the VS2008 Command Prompt window from my menu using "Run as Admin" before I could successfully get WcfSvcHost to run my service.

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

like image 472
Mike K Avatar asked Dec 30 '22 04:12

Mike K


1 Answers

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

Short version: pre-register the url/namespace from a privileged console

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

like image 158
mostlytech Avatar answered Jan 03 '23 01:01

mostlytech