2011-08-10 11 views
11

他のすべてが正常に動作しますが、https経由でSOAPおよびRESTful呼び出しを行うことができます。しかし、WSDLは常に空白を返します(不正な要求)。 HTTPはWSDLを正常に返します。IIS 7.5 Wcf https WSDLは常に空白(不正な要求)を返します

トレースログ内部例外レポートは:

The body of the message cannot be read because it is empty. 

serviceMetaDataタグが設定されている:

<serviceMetadata 
httpGetEnabled="true" 
policyVersion="Policy15" 
httpsGetEnabled="true" /> 

のWeb.configセクション バインディングを:

<bindings> 
     <basicHttpBinding> 
      <binding name="soapBinding"> 
       <security mode="None"> 
       </security> 
      </binding> 
     </basicHttpBinding> 
     <webHttpBinding> 
      <binding name="webBinding"> 
       <security mode="None"> 
       </security> 
      </binding> 
     </webHttpBinding> 
    </bindings> 

あなたはすぐにセキュリティモードに気づくでしょう= 「なし」

経由ServiceHostFactoryは私のように輸送するモードを参照してください。

 ServiceHost serviceHost = new ServiceHost(service.GetType(), baseAddresses); 

     if (ExposeSSL(baseAddresses[0])) 
     { 
      foreach (var endpoint in serviceHost.Description.Endpoints) 
      { 
       if (endpoint.Binding is WebHttpBinding) 
       { 
        ((WebHttpBinding)endpoint.Binding).Security.Mode = WebHttpSecurityMode.Transport; 
        endpoint.Address = new EndpointAddress(baseAddresses[0].ToString().Replace("http", "https")); 
       } 
       if (endpoint.Binding is BasicHttpBinding) 
       { 
        ((BasicHttpBinding)endpoint.Binding).Security.Mode = BasicHttpSecurityMode.Transport; 
        endpoint.Address = new EndpointAddress(baseAddresses[0].ToString().Replace("http", "https")); 
       } 
      } 

サービス構成:

 <service name="xxxx.Wcf.AdminJsonService" behaviorConfiguration="DefaultBehaviour"> 
      <host> 
       <baseAddresses> 
        <!-- note, choose an available port--> 
        <add baseAddress="http://localhost:62701/json"/> 
       </baseAddresses> 
      </host> 
      <!-- Service Endpoints --> 
      <endpoint address="" binding="webHttpBinding" bindingConfiguration="webBinding" behaviorConfiguration="jsonBehavior" bindingNamespace="https://www.xxxx/WebService4/AdminJsonService" contract="xxxx.Wcf.IAdminJsonService"/> 
     </service> 

     <service name="xxxx.Wcf.AdminXmlService" behaviorConfiguration="DefaultBehaviour"> 
      <host> 
       <baseAddresses> 
        <!-- note, choose an available port--> 
        <add baseAddress="http://localhost:62701/xml"/> 
       </baseAddresses> 
      </host> 
      <!-- Service Endpoints --> 
      <endpoint address="" binding="webHttpBinding" bindingConfiguration="webBinding" behaviorConfiguration="poxBehavior" bindingNamespace="https://www.xxx/WebService4/AdminXmlService" contract="xxxx.Wcf.IAdminXmlService"/> 
     </service> 

     <service name="xxxx.Wcf.AdminSoapService" behaviorConfiguration="DefaultBehaviour"> 
      <!-- Service Endpoints --> 
      <endpoint binding="basicHttpBinding" behaviorConfiguration="soapBehavior" bindingNamespace="https://www.example.com/WebService4/AdminSoapService" contract="xxxx.Wcf.IAdminSoapService"/> 
      <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /> 
     </service> 

エンドポイント

  <!-- SOAP --> 
      <behavior name="soapBehavior"> 
      </behavior> 
      <!-- JSON --> 
      <behavior name="jsonBehavior"> 
       <webHttp/> 
      </behavior> 
      <!-- POX --> 
      <behavior name="poxBehavior"> 
       <webHttp/> 
      </behavior> 

サービス行動

  <behavior name="ErrorBehaviour"> 
       <serviceDebug includeExceptionDetailInFaults="true"/> 
      </behavior> 
      <behavior name="DefaultBehaviour"> 
       <NiceErrorHandler/> 
       <!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information --> 
       <serviceDebug includeExceptionDetailInFaults="true"/> 

       <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment --> 
       <serviceMetadata 
        httpGetEnabled="true" 
        policyVersion="Policy15" 
        httpsGetEnabled="true" /> 
      </behavior> 
をビヘイビア

<serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true"/> 

誰もがこれが発生することができる理由アイデアだ持っていますか?

+0

これを把握しましたか? –

+1

WSDLリクエストのURLを表示できますか? –

+0

私は質問者が1週間でこれらの質問に答えなかったのでこの質問を落とした! –

答えて

0

他のエンドポイントのいずれかをオフにしましたか?私の場合、エンドポイントの1つを無効にするまで、WCFは機能しませんでした。どの人が無効にしたかは問題ではありませんでした。他はうまくいくでしょう。

<services> 
     <service name="GTW.TrendToolService" behaviorConfiguration="MyServiceBehavior"> 
     <!--<endpoint name="rest" address="" binding="webHttpBinding" contract="TT.ITrendtoolService" behaviorConfiguration="restBehavior"/>--> 
     <endpoint name="json" address="json" binding="webHttpBinding" behaviorConfiguration="jsonBehavior" contract="GTW.IAqvService" /> 
     <endpoint name="xml" address="xml" binding="webHttpBinding" behaviorConfiguration="restBehavior" contract="GTW.IAqvService" /> 
     <!--<endpoint name="mex" address="mex" binding="mexHttpBinding" contract="GTW.IAqvService" /> 
     <endpoint name="soap" address="soap" binding="basicHttpBinding" contract="GTW.IAqvService" />--> 
     </service> 
    </services> 
<behaviors> 
    <serviceBehaviors> 
    <behavior name="MyServiceBehavior"> 
     <serviceMetadata httpGetEnabled="true" /> 
     <serviceDebug includeExceptionDetailInFaults="true" /> 
    </behavior> 
    </serviceBehaviors> 
    <endpointBehaviors> 
    <behavior name="restBehavior"> 
     <webHttp /> 
    </behavior> 
    <behavior name="jsonBehavior"> 
     <enableWebScript /> 
    </behavior> 
    </endpointBehaviors> 
</behaviors> 
0

あなたの問題は、サービスの動作セクションに関連すると思われます。具体的には、HTTPではなくHTTPSでWSDLをパブリッシュするように.netに指示しました。以下を試してください

 <behavior name="DefaultBehaviour"> 
      <NiceErrorHandler/> 
      <!-- To receive exception details in faults for debugging purposes, set the value below to true. Set to false before deployment to avoid disclosing exception information --> 
      <serviceDebug includeExceptionDetailInFaults="true"/> 

      <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment --> 
      <serviceMetadata 
       httpGetEnabled="true" 
       httpsGetEnabled="true" 
       policyVersion="Policy15" 
       httpsGetEnabled="true" /> 
     </behavior> 

httpではなくhttpsGetを参照するserviceMetadataの余分な行に注意してください。

私がhttpsを使用すると、HTTP WSDLではなく、バインディングや何かを見つけることができないといういくつかのむにゃむにゃジャンボを見ることができることを考えるとバインディングの両方で、アプリケーションで有効になっていることを前提としています...

0

ときトランスポートの暗号化を行っています。ベースアドレスプロトコルにsを追加する必要があります。例:< baseAddress = "https:// localhost:62701/xml" />または<を追加します。baseAddress = "http:// localhost:62701/json "/>

関連する問題