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!
It seems to me that either a firewall on the server or another configuration setting is blocking the port.
If not, then your service may be experiencing an error during the creation of the ServiceHost object instance or during the creation of the service endpoint, and the error is for some reason not trapped(?). You could write some simple internal test loop within the service code to verify that the service endpoint was created correctly. That might reveal something interesting.
Additionally, running a client from that server and connecting to your service that is running on the development machine might tell you something more? You could use WCFTestClient.exe, as referenced here: Is it possible to make the WcfTestClient work for custom transport channels?. That might give you additional information. However, you will need to support MetadataExchange (Mex) in your service in order to use that test client.
Alternatively, you could use the WCF samples from the Visual Studio 2008 Samples folder, combined with WCFTestClient.exe to test some services that are self-hosted and are expected to work correctly, first within the server and then from outside of the server.