2

WCFサービスを構成するのに問題があります。私の要件は、basicHttpBindingエンドポイントとnetTcpBindingエンドポイントを公開することです。一部のクライアントは.NET2.0であり、WSDL.exeを介してプロキシを生成できる必要があります。

ほとんどの部分で機能しているようですが、WSDLを取得しようとすると、連携していません。ブラウザでは、SOAP XMLタグが返されますが、完全なWSDLではありません。WSDL.exeは私に一連のエラーを与えます:

エラー:「http://1.2.3.4:9877/MyService/basicHttp?wsdl」の処理中にエラーが発生しました。

  • ドキュメントは理解されましたが、処理できませんでした。
  • WSDLドキュメントには、解決できなかったリンクが含まれています。
  • 'http:// localhost:9877 / MyService / basicHttp?wsdl=wsdl0'のダウンロード中にエラーが発生しました。
  • 基になる接続が閉じられました:リモートサーバーに接続できません。

これが私のホスト構成です。ここで何か間違っているものが飛び出しますか?

<system.serviceModel>
  <services>
    <service behaviorConfiguration="MyServiceBehavior" name="MyRunner">
      <endpoint address="netTcp" binding="netTcpBinding" bindingConfiguration="" contract="IMyRunner">
        <identity>
          <dns value="localhost" />
        </identity>
      </endpoint>
      <endpoint address="basicHttp" binding="basicHttpBinding" bindingConfiguration="" contract="IMyRunner">
      </endpoint>
      <endpoint address="mex" binding="mexHttpBinding" bindingConfiguration="" contract="IMetadataExchange" />
      <endpoint address="mex" binding="mexTcpBinding" bindingConfiguration="" contract="IMetadataExchange" />
      <host>
        <baseAddresses>
          <add baseAddress="net.tcp://localhost:9876/MyService/netTcp" />
          <add baseAddress="http://localhost:9877/MyService/basicHttp" />
        </baseAddresses>
      </host>
    </service>
  </services>
  <behaviors>
    <serviceBehaviors>
      <behavior name="MyServiceBehavior">
        <serviceMetadata httpGetEnabled="true" />
        <serviceDebug includeExceptionDetailInFaults="false" />
      </behavior>
    </serviceBehaviors>
  </behaviors>
</system.serviceModel>
4

2 に答える 2

1

2つのMEXエンドポイントがある場合は、それぞれに個別のアドレスが必要です。一方を「mex」と呼び、次にもう一方を「mex2」などと呼びます。

<service behaviorConfiguration="MyServiceBehavior" name="MyRunner">
      <endpoint address="netTcp" binding="netTcpBinding" bindingConfiguration="" contract="IMyRunner">
        <identity>
          <dns value="localhost" />
        </identity>
      </endpoint>
      <endpoint address="basicHttp" binding="basicHttpBinding" bindingConfiguration="" contract="IMyRunner">
      </endpoint>
      <endpoint address="mex" binding="mexHttpBinding" bindingConfiguration="" contract="IMetadataExchange" />
      <endpoint address="mex2" binding="mexTcpBinding" bindingConfiguration="" contract="IMetadataExchange" />
      <host>
        <baseAddresses>
          <add baseAddress="net.tcp://localhost:9876/MyService/netTcp" />
          <add baseAddress="http://localhost:9877/MyService/basicHttp" />
        </baseAddresses>
      </host>
    </service>

(OPのコメントによると、彼はIISでホストしていないので、これは関係ありません)

また、IISでホスティングしていますか?その場合、ベースアドレス(少なくともHTTPアドレス)は無意味です。サーバー、仮想ディレクトリ、およびSVCファイルの場所によって、サービスアドレスが決まります。

http://YourServer/YourVirtualDirectory/SubDirectory/YourService.svc/basicHttp

「通常の」サービスエンドポイントの場合、または

http://YourServer/YourVirtualDirectory/SubDirectory/YourService.svc/mex

HTTPベースのMEXエンドポイント用。

于 2011-01-25T06:56:30.163 に答える
0

ヒントをありがとう。問題は、baseAddress値が「localhost」を指していることにあることがわかりました。生成されたWSDLでは、まだ「localhost」と表示されているため、WSDL.exeはサーバーではなくlocalhost(私の開発マシン)に到達しようとしているようです。「localhost」をサービスをホストするサーバーの実際のIPに変更すると、.NET1.1でもWSDL.exeが正常に機能しました。また、svcutil.exeを使用して4.0バージョンを入手することもできます。

于 2011-01-25T15:59:42.413 に答える