WCF ServiceHost basicHttpBinding 503 error

basichttpbindingservicehostwcf

I'm trying to run a WCF ServiceHost as an NT Service on a Windows 2007 SP1 Server. The ServiceHost is reponsible for hosting a single service endpoint: a basicHttpBinding with the following address:

http://localhost:5555/ToBlah

When I run this ServiceHost on my local machine (Windows XP), it works fine – when I POST a SOAP message to it, I get back an HTTP 202 code ("Accepted"), which is the correct response for my service because the contract has IsOneWay=true. However, when I run this on my 2007 server, I get 503 errors when I try to call the service. I have the WCF message logging turned "all the way up," but I'm not seeing any logging whatsoever, which leads me to believe that this is happening at a lower level than WCF (the call never gets to the WCF "layer").

The sys-admins and I have tried various forms of httpcfg commands, but no luck so far.

I know trying to host this in IIS might be a possible solution, but our production app server does not have IIS installed, so I would like to just run the service as a ServiceHost.

Any ideas would be greatly appreciated!

Best Answer

Well, I still can't get it to work on the Vista servers - it's still giving 503 errors, but I ended up getting it setup on a Windows 2003 server, and it seems to be working now.

One thing I did learn in this process was the use of HttpCfg.exe to allow a user to open a non-standard HTTP port.

Basically I had to run something like the following command:

httpcfg.exe set urlacl /u http://+:5555/ /a "O:AOG:DAD:(A;;RPWPCCDCLCSWRCWDWOGA;;;S-1-0-0)"

You can then view the URL ACL settings with this command:

httpcfg.exe query urlacl

On Vista, you can run the same types of commands using netsh (see link below).

Sadly, this took awhile to figure out, but it was a good learning experience.

Here are some links that I thought were useful in figuring this out:

Related Topic