4

これは本当に簡単です。Visual Studioでうまく動作するwcfサービス(特別なものはなく、[新しいプロジェクト]-> [WCFサービスアプリケーション]だけ)があります。クラスター化されたIIS6環境にデプロイすると、ほとんど機能します。リクエストを送信して応答を得ることができます。

ただし、生成されたメタデータは、クラスターの仮想名ではなく、クラスター内の特定のノードを一貫して参照します。

https://clustername.test.com/WcfService1/Service1.svc

HTMLで次のように表示されます。

Service1 Service

You have created a service.

To test this service, you will need to create a client 
and use it to call the service. You can do this using 
the svcutil.exe tool from the command line with the 
following syntax:

svcutil.exe https://node1.test.com/DocrRetention/Service1.svc?wsdl

これは、クラスター名ではなくノード名(node1.test.com)を示しています。

https://clustername.test.com/WcfService1/Service1.svc?wsdl 

次のxmlを示します。

...
    <wsdl:types>
        <xsd:schema targetNamespace="http://tempuri.org/Imports">
            <xsd:import schemaLocation="https://node1.test.com/WcfService1/Service1.svc?xsd=xsd0" namespace="http://tempuri.org/"/>
            <xsd:import schemaLocation="https://node1.test.com/WcfService1/Service1.svc?xsd=xsd1" namespace="http://schemas.microsoft.com/2003/10/Serialization/"/>
            <xsd:import schemaLocation="https://node1.test.com/WcfService1/Service1.svc?xsd=xsd2" namespace="http://schemas.datacontract.org/2004/07/WcfService1"/>
        </xsd:schema>
    </wsdl:types>
...
    <wsdl:service name="Service1">
        <wsdl:port name="BasicHttpBinding_IService1" binding="tns:BasicHttpBinding_IService1">
            <soap:address location="https://node1.test.com/WcfService1/Service1.svc"/>
        </wsdl:port>
    </wsdl:service>
</wsdl:definitions>

ここでも、仮想ホストではなくノード名を表示します。

では、私のweb.configはどのように見えますか?小さいので全部お見せします。

<?xml version="1.0"?>
<configuration>

  <system.web>
    <customErrors mode="Off"/>
    <compilation debug="true" strict="false" explicit="true" targetFramework="4.0" />
  </system.web>
  <system.serviceModel>
    <bindings>
      <basicHttpBinding>
        <binding>
          <security mode="Transport"/>
        </binding>
      </basicHttpBinding>
    </bindings>
    <services>
      <service name="WcfService1.Service1">
        <endpoint binding="basicHttpBinding" contract="WcfService1.IService1"/>
        <endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" />
      </service>
    </services>
    <behaviors>
      <serviceBehaviors>
        <behavior>
          <serviceMetadata httpsGetEnabled="true"/>
          <serviceDebug includeExceptionDetailInFaults="true"/>
        </behavior>
      </serviceBehaviors>
    </behaviors>
  </system.serviceModel>

</configuration>
4

1 に答える 1

7

私が知っているように、WSDL の URL はデフォルトでホスティング サーバーから派生します。.NET 3.5 SP1 の一部の KB では、ホスト ヘッダーから URL を使用できる新しい動作が導入されました。この動作は、.NET 4.0 にも含まれていました。チェック: useRequestHeadersForMetadataAccess。この記事の最後に、この動作に関する説明があります。

于 2010-09-02T20:25:43.107 に答える