簡體   English   中英

為什么通過WCF通過https調用.Net 2.0 Web服務時,我收到400錯誤的請求?

[英]Why am I getting 400 bad request when calling a .Net 2.0 web service from WCF over https?

我有一個Web服務,其中包含運行生成報告所需的方法。 Web服務方法是用.Net 2.0編寫的,並且可以在我的測試系統上正常運行,該測試系統與實時系統在同一服務器上運行。 唯一的區別是實時版本使用https。

每當我將端點地址更改為實時服務並運行我的應用程序時,我只會從IIS返回400(錯誤請求)錯誤。

我需要在app.config中的WCF設置中更改一些特定的配置設置以使其與https一起使用嗎?

通過“添加服務參考”創建的生成的app.config設置如下:

<system.serviceModel>
    <bindings>
        <basicHttpBinding>
            <binding name="ReportsSoap" closeTimeout="00:01:00" openTimeout="00:01:00"
                receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false"
                bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
                maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
                messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
                useDefaultWebProxy="true">
                <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                    maxBytesPerRead="4096" maxNameTableCharCount="16384" />
                <security mode="Transport" >
                    <transport clientCredentialType="None" proxyCredentialType="None"
                        realm="" />
                    <message clientCredentialType="UserName" algorithmSuite="Default" />
                </security>
            </binding>

        </basicHttpBinding>
    </bindings>
    <client>

        <endpoint address="https://www.mysite.com/subdir/subdir/Reports.asmx"
            binding="basicHttpBinding" bindingConfiguration="ReportsSoap"
            contract="SystemReports.ReportsSoap" name="ReportsSoap" />
    </client>
</system.serviceModel>

是的,您必須更改綁定配置才能使用傳輸安全性。

<bindings>
  <basicHttpBinding>
    <binding name="YourCurrentBindingName" ...>
      <security mode="Transport" />
    </binding>
  </basicHttpBinding>
</bindings>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM