簡體   English   中英

在WCF 4.X中配置netTcpBinding的正確方法是什么

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

我正在開發一個綁定必須為“ netTcpBinding”的WCF應用程序,但是在Visual Studio 2013中運行它時,出現此錯誤“無法獲取元數據http://本地主機:62081 / Queue.svc”。 我進行了嚴格的搜索,但沒有找到工作的例子。 我想了解這是如何工作的。 謝謝!!! 在下面,您將找到我的Web配置:

<?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>

希望仍然有幫助

我認為它需要實際的元數據URL,請嘗試像這樣添加

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

我正在使用帶有.NET 4的自托管WCF服務,但我認為不會有太多差異。

HTH

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM