2010-05-25 52 views
2

我在嘗試使用僅在HTTPS上運行但在VS中使用「add service」方法或使用WSDL生成代碼文件的web服務, ,指出其HTTP Web服務...在.net 3.5 Web項目中使用HTTPS Web服務

<wsdl:service name="OGServ"> 
    <wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">XML Web Services element of OGServ Gateway</wsdl:documentation> 
    <wsdl:port name="OGServSoap" binding="tns:OGServSoap"> 
     <soap:address location="http://ogserv.domain.co.uk/ogwsrv/og.asmx" /> 
    </wsdl:port> 
    <wsdl:port name="OGServSoap12" binding="tns:OGServSoap12"> 
     <soap12:address location="http://ogserv.domain.co.uk/ogwsrv/og.asmx" /> 
    </wsdl:port> 
    </wsdl:service> 

這會是,即使當我改變在app.config端點地址(由附加服務所產生)到HTTPS它的原因說,它期待的HTTP?

錯誤:

EC.Tests.OGGatewayLayerTest (TestFixtureSetUp): 
System.ArgumentException : The provided URI scheme 'https' is invalid; expected 'http'. 
Parameter name: via 

回答

0

當您添加Web服務項目中使用 「https」 開頭的URI方案。這將生成一個具有正確位置屬性的WSDL文件。沿着這些路線的東西:

https://ogserv.domain.co.uk/ogwsrv/og.asmx?WSDL

如果你手工編輯WSDL那麼你的更改將被覆蓋當您使用Visual Studio中的「更新服務」選項。

+0

我最初使用https://ogserv.domain.co.uk/ogwsrv/og.asmx?WSDL添加服務,WSDL文件包含上面顯示的代碼,它說它位於HTTP://。 HTTP://地址中沒有任何內容僅作爲其HTTPS。 因此,當代碼嘗試訪問代理時引發錯誤。 – 2010-05-25 12:33:17

+0

如果您將URL粘貼到Internet Explorer中。你得到了什麼? – Garett 2010-05-25 17:17:37

+0

如果我將http://域中的域名作爲其HTTPS獲取域名。 「糟糕!谷歌瀏覽器無法連接到等」+對不起,對於慢速回復 – 2010-05-26 10:39:18