I have many WCF services and I need to call one service from another. I decided to use netNamedPipeBinding
for this purpose.
My web.config file looks like this. (I have not copied irrelevant stuff here.)
<services>
<service name="Services.AuthorizationService" >
<endpoint contract="IMetadataExchange" binding="mexHttpBinding" address="mex" >
<endpoint
name="AuthorizationService"
address=""
binding="basicHttpBinding" contract="ServiceContracts.IAuthorizationService" />
<endpoint address="net.pipe://localhost/TestSite/AuthorizationService.svc"
binding="netNamedPipeBinding" contract="ServiceContracts.IAuthorizationService"
name="AuthorizationNamedPipeEndpoint"/>
</service>
</Services>
The client section in the web.config file looks like this:
<client>
<endpoint address="net.pipe://localhost/TestSite/AuthorizationService.svc"
binding="netNamedPipeBinding" contract="ServiceContracts.IAuthorizationService" name="AuthorizationServiceNamedPipe" />
</client>
I am trying to call one of the OperationContract
s (GetDetails) like this:
using (ChannelFactory<IAuthorizationService> authorizationChannel = new ChannelFactory<IAuthorizationService>("AuthorizationServiceNamedPipe"))
{
IAuthorizationService authorizationService = authorizationChannel.CreateChannel();
var response = authorizationService.GetDetails(new GetDetailsRequestMessage());
}
When I execute this code, I get the exception at the line I invoke the OperationContract GetDetails:
There was no endpoint listening at net.pipe://localhost/TestSite/AuthorizationService.svc that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.
I am not able to find out the exact problem. There is no InnerException as well. I am using Windows7 machine and IIS version is IIS7.5. Please note that I can call this service from my Winform application without any problem. net.pipe binding is added to the website bindings in the IIS.
How to ensure that the service is working properly using the net.pipe transport? In case of HTTP, we can browse in IE and ensure it.
This problem was solved after activating Windows Communication Foundation Non-HTTP Activation
component from the Control Panel —> Programs and Features, and then click "Turn Windows Components On or Off" in the left pane. Expand the Microsoft .NET Framework 3.5
.
When it's activated and you use non-HTTP binding, the WAS is automatically used.
I did a very basic & silly mistake but it helped me to learn many things. The following articles helped me a lot:
Extend Your WCF Services Beyond HTTP With WAS
Hosting WCF Services in Windows Activation Service
WCF gets Access denied when the consumer try invoke a WCF service calls hosted on Virtual Machine
The last link gave me a pointer that Server Certificate related configuration might be causing troubles. And I was adding a behavior (which is not seen in the question) for the service. That behaviour was using the Server Certificates.