我有一個Web服務,其中包含我需要運行以生成報告的方法。 Web服務方法使用.Net 2.0編寫,並且可以在我的測試系統上正常工作,該系統與實時系統在同一臺服務器上運行。唯一的區別是實時版本使用https。爲什麼當通過https調用WCF的.Net 2.0 Web服務時,我得到了400個錯誤的請求?
每當我將端點地址更改爲實時服務並運行我的應用程序時,我僅從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>
這也可能是相關的,我在內聯網上,並通過需要驗證的代理訪問外部主機名。我試圖改變它從IP訪問,但WCF抱怨證書無效(因爲它看起來在主機名) – Tjaart 2010-10-07 12:23:26