簡體   English   中英

如何將netTcpBinding和netMsmqBinding一起使用?

[英]How to use netTcpBinding and netMsmqBinding together?

I am trying to use both tcp as well as msmq but it gives an error msmq doesn't support dual binding or it's not properly configured, how to solve this issue? 
I have created two end points. 

I tried to do something like this 



  <?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <system.serviceModel>
    <bindings>
      <netTcpBinding>
        <binding name="Binding_Config" receiveTimeout="00:10:00" sendTimeout="00:10:00" openTimeout="00:02:30">
          <security mode="None">
            <transport clientCredentialType ="None" protectionLevel="None"></transport>
            <message clientCredentialType="None"/>
          </security>
        </binding>
      </netTcpBinding>

      <netMsmqBinding>
        <binding name="ServiceBinding" durable="true" exactlyOnce="true" useActiveDirectory="false" receiveTimeout="00:10:00" sendTimeout="00:10:00" openTimeout="00:02:30" >
          <security mode="None">
            <transport
               msmqAuthenticationMode="None"
               msmqProtectionLevel="None"

              />
          </security>
        </binding>
      </netMsmqBinding>
    </bindings>

    <services>
      <service name="WCFLib.SignalService"
        behaviorConfiguration = "SignalServiceMEXBehavior">
        <endpoint address ="TradeSignalService"
        binding="netTcpBinding"
        contract="TradeServiceLib.ITradeSignalService" bindingConfiguration="Binding_Config"/>
        <!-- Enable the MEX endpoint -->

        <!-- Need to add this so MEX knows the address of our service -->


        <endpoint  address="net.msmq://localhost/private/FirstQueue" binding="netMsmqBinding" contract="TradeServiceLib.ITradeSignalService" bindingConfiguration="ServiceBinding"/>
        <!--<endpoint address="mex" binding="netTcpBinding" contract="IMetadataExchange"/>-->


        <host>
          <baseAddresses>
            <add baseAddress ="http://192.168.1.125:2344"/>
            <add baseAddress ="net.tcp://192.168.1.125:2348"/>
          </baseAddresses>
        </host>
      </service>
    </services>
    <!-- A behavior definition for MEX -->
    <behaviors>
      <serviceBehaviors>
        <behavior name="SignalServiceMEXBehavior" >
          <serviceMetadata httpGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="true"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
  </system.serviceModel>

  <connectionStrings>
    <clear />

  </connectionStrings>

</configuration>

I am not sure where I am wrong. 

我不知道為什么,但是此站點需要我提供更多文本,因此請鍵入此行,請忽略此內容。我不知道為什么,但是此站點需要我獲得更多文本,因此請鍵入此行,請忽略此信息,我不知道為什么但是此站點需要我發送更多文本,因此請鍵入此行,請忽略此行,我不知道為什么,但此站點需要我發送更多行,請忽略此消息,我不知道為什么,但此站點需要更多文本從我這里輸入,請忽略此行

這兩個綁定非常不同。 對於同一服務,您需要兩個端點在不同的地址公開並設置不同的綁定。

有關更多信息,請參見此MSDN文章。

舉個例子:

<service 
    name="Microsoft.ServiceModel.Samples.CalculatorService"
    behaviorConfiguration="CalculatorServiceBehavior">
  <!-- This endpoint is exposed at the base address provided by host:
       http://localhost/servicemodelsamples/service.svc  -->
  <endpoint address=""
            binding="basicHttpBinding"
            contract="Microsoft.ServiceModel.Samples.ICalculator" />
  <!-- secure endpoint exposed at {base address}/secure:
       http://localhost/servicemodelsamples/service.svc/secure -->
  <endpoint address="secure"
            binding="wsHttpBinding"
            contract="Microsoft.ServiceModel.Samples.ICalculator" />
  ...
</service>

暫無
暫無

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

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