basichttpbindingとnettcpbindingの両方を備えたWCFサービス。 HTTPエンドポイントにアクセスできません
-
08-10-2019 - |
質問
NettcpbindingとBasichttpbindingを使用して、同じインターフェイスを利用可能にしたいと思います。また、両方のエンドポイントでWSDLを利用できるようにしたいと思います。アクセスするとき http://localhost:9876/TestService/
, 、私はTCPエンドントの情報を持っているMEXエンドポイントを取得します http://localhost:9876/TestService/?wsdl
, 、しかしアドレス http://localhost:9876/TestService/ws
応答しません、そして私はその理由を理解できません。ベースアドレスと相対アドレスがあります。誰かが私に手を貸すことができますか?今、私はちょうど証言サービスを働かせようとしているだけで、Messaginimplementationサービスを台無しにしていません。
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="SimpleBinding" />
</basicHttpBinding>
<netTcpBinding>
<binding name="DefaultTCPBinding" transactionFlow="true" />
</netTcpBinding>
</bindings>
<behaviors>
<serviceBehaviors>
<behavior name="MetadataBehavior">
<serviceMetadata httpGetEnabled="true" httpGetBinding="webHttpBinding"
httpGetBindingConfiguration="" />
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service behaviorConfiguration="MetadataBehavior" name="CompanyX.AppServer.Implementation.TestImplementation">
<endpoint address="" binding="netTcpBinding" bindingConfiguration="DefaultTCPBinding"
name="TestTCPEndpoint" contract="CompanyX.AppServer.Interfaces.ITest" />
<endpoint address="mex" binding="mexHttpBinding" bindingConfiguration=""
name="TestMex" contract="IMetadataExchange" />
<endpoint address="/ws" binding="basicHttpBinding" bindingConfiguration="SimpleBinding"
name="Test" contract="CompanyX.AppServer.Interfaces.ITest" />
<host>
<baseAddresses>
<add baseAddress="net.tcp://localhost:9878/TestService" />
<add baseAddress="http://localhost:9876/TestService/" />
</baseAddresses>
</host>
</service>
<service behaviorConfiguration="MetadataBehavior" name="CompanyX.AppServer.Implementation.MessaginImplementation">
<endpoint address="" binding="netTcpBinding" bindingConfiguration="DefaultTCPBinding"
name="MessagingTCPEndpoint" contract="CompanyX.AppServer.Interfaces.IMessaging" />
<endpoint address="mex" binding="mexHttpBinding" bindingConfiguration=""
name="MessagingMex" contract="CompanyX.AppServer.Interfaces.IMessaging" />
<host>
<baseAddresses>
<add baseAddress="net.tcp://localhost:9878/MessagingService" />
<add baseAddress="http://localhost:9876/MessagingService" />
</baseAddresses>
</host>
</service>
</services>
</system.serviceModel>
</configuration>
解決
それは私の側の新人の間違いです。それは実際には正しいです。答えはあります 以下の投稿。 Base HTTPクラスにヒットしたときにブラウザから応答を取得しますが、このWSDLを使用すると、両方のバインディングに接続できます。
他のヒント
私はあなたのサービスエンドポイントアドレスが間違っていると思います:
<endpoint address="/ws" binding="basicHttpBinding" bindingConfiguration="SimpleBinding"
name="Test" contract="CompanyX.AppServer.Interfaces.ITest" />
相対アドレスであるため(ベースアドレスに追加)、ただ ws
- 前向きなスラッシュはありません:
<endpoint name="Test"
address="ws"
binding="basicHttpBinding" bindingConfiguration="SimpleBinding"
contract="CompanyX.AppServer.Interfaces.ITest" />
フォワードスラッシュなしで試してみてください!そのように機能するはずです。
所属していません StackOverflow