I was fooling around with WCF today and started getting the following exception:
AddressAccessDeniedException: HTTP could not register URL http://+:8370/TestService/. Your process does not have access rights to this namespace.
The problem is pretty simple, but it took me a little while to figure out. To host the WCF service, you need to have the ability to register the URL. I run visual studio as a non-administrator, and this requires administrator privileges.
But wait just one second, this service was running fine just a couple minutes ago and I didn't have administrator privileges then. How did that work? Well, it seems that VS automatically registers any URLs in the form of http://[server]:[port]/Design_Time_Addresses/[Rest of Service Url] which allows them to be hosted.
So, I was trying to be too fancy and I was trying to change the URL to get rid of the "Design_Time_Addresses" part of the URL. I added that back to the URL and I was able to host the service again.
If you want to host the URL without the "Design_Time_Addresses" bit, you will have to register (as admin) the URL. Follow the link in the exception details to see how to register the URL.
Tuesday, March 16, 2010
WCF blank page - some fixes
I was having a bit of trouble getting my WCF service to behave nicely. Specifically, I kept getting a blank page instead of the friendly WCF service page when I used a browser to hit the service. I stumbled on a couple things.
1. The URL you are using in your browser has to end with a slash, for example http://servername:8080/TestService/ will result in a WCF service page. If you forget the slash at the end, you get a blank page.
2. In the config file, base addresses and relative addresses in the endpoint do not seem to play nicely. I had to put the full URL (with a slash at the end) in the base address and leave the endpoint address blank (address="").
I must be missing something. Configuration files should not be this finicky.
1. The URL you are using in your browser has to end with a slash, for example http://servername:8080/TestService/ will result in a WCF service page. If you forget the slash at the end, you get a blank page.
2. In the config file, base addresses and relative addresses in the endpoint do not seem to play nicely. I had to put the full URL (with a slash at the end) in the base address and leave the endpoint address blank (address="").
I must be missing something. Configuration files should not be this finicky.
Subscribe to:
Posts (Atom)