The service must be running before you can add a reference to it.
You can run the service project separately from the context menu within Solution Explorer.
Question
I am going through the walkthrough "How to: Use netTcpBinding with Windows Authentication and Transport Security in WCF Calling from Windows Forms"
http://msdn.microsoft.com/en-us/library/ff647180.aspx
When I get to "Step 7: Create a Test Client Application" and substep 5: "5.In the Add Service Reference dialog box, set the Service URI: to net.tcp://localhost:8523/WCFTestService and then click Go"
I get "The URI prefix is not recognized. Metadata contains a reference that cannot be resolved".
It's as if the "Add Service Reference" doesn't recognize the "net.tcp" binding.
I'm on Windows 7 x64 using Visual Studio 2012 and my project is targeting x86 and Framework 4.5.
I found this thread
An error in the MSDN walk-through - "How to: Host WCF in a Windows Service Using TCP"
But they didn't have a problem when the client was in the same solution. I am.
Service Config:
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="Publisher.MyServiceBehavior">
<serviceMetadata httpGetEnabled="false" httpsGetEnabled="false" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service name="POC_WcfTcpSubscribePublishService.Publisher">
<endpoint address="" binding="netTcpBinding" bindingConfiguration=""
name="NetTcpBindingEndpoint" contract="POC_WcfTcpSubscribePublishService.IPublisher">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexTcpBinding" bindingConfiguration=""
name="MexTcpBindingEndpoint" contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="net.tcp://localhost:8523/WcfTcpSubscribePublish" />
</baseAddresses>
</host>
</service>
</services>
</system.serviceModel>
any pointers are welcome.
La solution
The service must be running before you can add a reference to it.
You can run the service project separately from the context menu within Solution Explorer.
Autres conseils
You have a service behavior: Publisher.MyServiceBehavior
But you don't apply that service behavior to your service. After service name="..." do this:
behaviorConfiguration="Publisher.MyServiceBehavior"