I am totally new to this and trying to host the simplest WCF service with a net.tcp binding I have Windows 7 Professional and IIS7 and have enabled NON http activation.
The Web.config looks like this (untouched)
<system.serviceModel>
<services>
<service name="WcfService2.Service1" behaviorConfiguration="WcfService2.Service1Behavior">
<endpoint address="" binding="wsHttpBinding" contract="WcfService2.IService1">
<!--
Upon deployment, the following identity element should be removed or replaced to reflect the
identity under which the deployed service runs. If removed, WCF will infer an appropriate identity
automatically.
-->
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"/>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="WcfService2.Service1Behavior">
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="true"/>
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
So far, so good. But what about that net.tcp binding. I add the "enabledProtocols" attribute so my applicationHost.config looks like this
<site name="WCFHOST" id="3">
<application path="/" applicationPool="WCFHOST" enabledProtocols="http,net.tcp,net.pipe,net.msmq">
<virtualDirectory path="/" physicalPath="C:\Prosjekter\temp\TestService\TestService" />
</application>
<bindings>
<binding protocol="net.tcp" bindingInformation="808:*" />
<binding protocol="http" bindingInformation="*:80:" />
</bindings>
</site>
Then I go to the IIS WCFHost website and add binding net.tcp 808:* And then I modify my web.config for the WCF Service to look like this. (just changed the binding on the endpoints)
<system.serviceModel>
<services>
<service name="WcfService2.Service1" behaviorConfiguration="WcfService2.Service1Behavior">
<!-- Service Endpoints -->
<endpoint address="" binding="netTcpBinding" contract="WcfService2.IService1">
<!--
Upon deployment, the following identity element should be removed or replaced to reflect the
identity under which the deployed service runs. If removed, WCF will infer an appropriate identity
automatically.
-->
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
<endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange"/>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="WcfService2.Service1Behavior">
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpGetEnabled="true"/>
<!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information -->
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
When I now try to add the service net.tcp://localhost:808/Service1.svc in my WcfTestClient.exe I get the error
Error: Cannot obtain Metadata from net.tcp://localhost/Service1.svc TCP-errorcode 10061: No connection could be made because the target machine actively refused it.... 127.0.0.1:808
My firewall is turned off. I have seen one thing, though.. when using netstat -a the 808 port is not listed there.. should it?
Can someone help me just creating my first WCF service with nettcp binding?
As Tocco says, check that the service is running. You can do this by checking:
netstat /an | find /i "808 "
And it should show:
TCP 0.0.0.0:808 0.0.0.0:0 LISTENING
TCP [::]:808 [::]:0 LISTENING
if the service is running correctly.
To get it to start if it's not already working, you can issue:
sc start NetTcpActivator
from the command line to ttry to start it.
Even before that, make sure that the non-HTTP activation windows components are installed.
Also check that the services are actually running. I had a problem where they would not necessarily start after a reboot.