I have two base addresses defined in my WCF Service config file:
Due to not having answers clear enough , I decided to find out by my self the best solution. Here is what you have to do to configure a WCF NET TCP service endpoint in IIS 7.0.
To achieve this, we need two steps:
1. Configure a config file for WCF net tcp endpoint
Below is a typical config file, notice that the value for "address", in service's endpoint, is empty.
Also notice that inside the node "host" Im adding 2 base addresses, an http and a net tcp protocols respectly. Since the service is hosted in IIS you don't have to worry about the absolute address in the endpoint, IIS figures this out based on the base address we have defined inside the node "host".
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="behaviorConfig">
<!--your custom behavior here-->
</behavior>
</serviceBehaviors>
</behaviors>
<bindings>
<basicHttpBinding>
<binding name="basicHttpBindingConfig"/>
</basicHttpBinding>
<netTcpBinding>
<!--our netTcpBinding binding-->
<binding name="netTcpBindingConfig"/>
</netTcpBinding>
</bindings>
<services>
<service name="MyNamespace.ServiceLayer.MyService" behaviorConfiguration="behaviorConfig">
<!--Endpoint for basicHttpBinding-->
<endpoint address="" binding="basicHttpBinding" contract="MyNamespace.ServiceLayer.IMyService" bindingConfiguration="basicHttpBindingConfig"/>
<!--Endpoint for netTcpBindingConfig-->
<endpoint address="" binding="netTcpBinding" contract="MyNamespace.ServiceLayer.IMyService" bindingConfiguration="netTcpBindingConfig">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<!--Make sure you add a mexTcpBinding, without it you will receive an error when trying to resolve service's reference-->
<endpoint address="mex"
binding="mexTcpBinding"
bindingConfiguration=""
name="MyServiceMexTcpBidingEndpoint"
contract="IMetadataExchange" />
<host>
<!--This part is important for IIS to determine the base addresses for your endpoints-->
<baseAddresses>
<!--Notice that baseAddress for net tcp is preceded by net.tcp -->
<!--then ://localhost:{port} -->
<!--Also the same for http, so you can figure out how to define a baseAddress for https-->
<add baseAddress="net.tcp://localhost:8090"/>
<add baseAddress="http://localhost:8080"/>
</baseAddresses>
</host>
</service>
</services>
</system.serviceModel>
2. Configure IIS for net tcp
In IIS, (after updated your service with new configuration) enable the net.tcp protocol. These are the steps:
After doing this, there is also another configuration:
Also, if you still cannot access service, you might need to start your Net.tcp listener adapter in your server. To achieve this, please follow next steps:
That's all you have to do to have a nettcp WCF endpoint enabled in IIS.
Hope this helps.
Regards
You defined a Net.TCP base address to be:
net.tcp://localhost:8001/TemplateReportService
Your endpoints with Net TCP are:
<endpoint address="TemplateService"
and
<endpoint address="ReportService"
So their complete service address will be "netTcp base address" + "relative address as defined on the <endpoint>
element" - this gives:
net.tcp://localhost:8001/TemplateReportService/TemplateService
and
net.tcp://localhost:8001/TemplateReportService/ReportService
respectfully.
Can you use them at these addresses??
Also - you defined a "mex" (metadata exchange) endpoint for the HTTP protocol - that's why you can see something when you navigate to the HTTP address. But you did not specify a MEX endpoint for netTcp.