2011-05-10 58 views
1

我有一個WCF服務託管在IIS下,負載均衡器後面。在LB上卸載SSL,然後以純HTTP方式調用該服務。通過HTTPS的SOAP端點返回400錯誤請求

我得到了服務的REST端點工作,但我似乎無法讓SOAP端點顯示wsdl頁面。當調用https://domain/Service.svc/soap?wsdl時,瀏覽器會收到一個400 Bar請求響應。我也檢查了svclog,錯誤是There is a problem with the XML that was received from the network. See inner exception for more details.這意味着它期待我做一個POST而不是GET併發送XML。從CONFIGS

摘錄:

<bindings> 
    <basicHttpBinding> 
     <binding name="basicBinding" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647"> 
      <security mode="Transport"></security> 
      <readerQuotas maxStringContentLength="2147483647" /> 
     </binding> 
    </basicHttpBinding> 
    <webHttpBinding> 
     <binding name="webBinding" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647"> 
      <security mode="Transport"></security> 
     </binding> 
    </webHttpBinding> 
</bindings> 

<services> 
    <service behaviorConfiguration="MyServiceBehavior" name="Namespace.Service"> 
     <endpoint address="" behaviorConfiguration="MyRESTBehavior" binding="webHttpBinding" bindingConfiguration="webBinding" name="REST" contract="Namespace.IService" /> 
     <endpoint address="https://domain/Service.svc/soap" binding="basicHttpBinding" bindingConfiguration="basicBinding" name="SOAP" contract="Namespace.IService" /> 
    </service> 
</services> 

<behaviors> 
    <serviceBehaviors> 
     <behavior name="MyServiceBehavior"> 
      <serviceMetadata httpGetEnabled="false" httpsGetEnabled="true"/> 
      <serviceDebug includeExceptionDetailInFaults="true"/> 
      <dataContractSerializer maxItemsInObjectGraph="6553600" /> 
     </behavior> 
    </serviceBehaviors> 
    <endpointBehaviors> 
     <behavior name="MyRESTBehavior"> 
      <webHttp/> 
     </behavior> 
    </endpointBehaviors> 
</behaviors> 

我嘗試使用的wsHttpBinding太多,但唯一不同的結果是越來越401!而非。任何方向讚賞。

回答

0

我找到了。我以前從serviceMetadata中刪除httpsGetUrl屬性,因爲我收到了有關發佈服務兩次的錯誤。我現在認爲這個錯誤可能是由於一個錯字,我不應該刪除httpsGetUrl。更改behaviors部分已解決我的問題:

<behaviors> 
    <serviceBehaviors> 
     <behavior name="MyServiceBehavior"> 
      <serviceMetadata httpGetEnabled="false" httpsGetEnabled="true" httpsGetUrl="https://domain/Service.svc/soap" /> 
      <serviceDebug includeExceptionDetailInFaults="true"/> 
      <dataContractSerializer maxItemsInObjectGraph="6553600" /> 
     </behavior> 
    </serviceBehaviors> 
    <endpointBehaviors> 
     <behavior name="MyRESTBehavior"> 
      <webHttp/> 
     </behavior> 
    </endpointBehaviors> 
</behaviors> 
+0

它不適用於我... – 2015-05-05 13:26:13

0

我不相信你可以使用basicHttpBinding端點的絕對地址。試試這個:

<endpoint address="soap" binding="basicHttpBinding" bindingConfiguration=... 

訪問WSDL您的網址應該是這個樣子: 「HTTPS://domain/soap/Service.svc WSDL」。使用IIS & WCF時,無法覆蓋虛擬目錄的URL。端點地址值應該與網站網址相關。

相關問題