简体   繁体   中英

What is the right way to configure netTcpBinding in WCF 4.X

I am developing a WCF application whose binding must be "netTcpBinding" but when I run it in Visual Studio 2013 I get this error "Unable to get metadata http: // localhost: 62081 / Queue.svc". I searched intensely as do but have not found an example where work. I would like to understand how this works. Thanks!!! Below you will find my web config:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
 <appSettings>
   <add key="aspnet:UseTaskFriendlySynchronizationContext" value="true" />
 </appSettings>
 <system.web>
   <compilation debug="true" targetFramework="4.5" />
 </system.web>
 <system.serviceModel>
   <behaviors>
     <serviceBehaviors>
       <behavior name="QueueBehavior">
         <serviceDebug includeExceptionDetailInFaults="true" />
         <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
    </behavior>
     </serviceBehaviors>
   </behaviors>
   <services>
     <service behaviorConfiguration="QueueBehavior" name="ComponenteCola.Queue">
       <endpoint address="" binding="netTcpBinding" bindingConfiguration=""
      name="QueueNetTcpEndPoint" contract="ComponenteCola.IQueue" />
       <endpoint address="mex" binding="mexTcpBinding" bindingConfiguration=""
      name="NetTcpMetadataPoint" contract="IMetadataExchange" />
       <host>
         <baseAddresses>
           <add baseAddress="net.tcp://localhost:57965/Queue" />
         </baseAddresses>
       </host>
     </service>
   </services>
 </system.serviceModel>
</configuration>

Hope still helps

I think it needs the actual metadata URL, try adding like this

<baseAddresses>
       <add baseAddress="net.tcp://localhost:57965/Queue" />
       <add baseAddress="http://localhost:62081/Queue/mex" />
</baseAddresses>

I'm working with self-hosted WCF Services with .NET 4, but I don't think there will be SO many differences.

HTH

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM