前幾天,在用wcf服務是,遇到這么一個問題:WCF異常: 提供的 URI 方案“https”無效,應為“http”。 參數名: via
本身對wcf不是很熟悉,在網上查找一番。終於解決問題。如有遇到此類問題,希望能有所幫助。
原因解析:
wcf原引用地址:https://192.168.1.1:8090/temp/sitservice
后因為服務地址改為:http://192.168.1.2:8090/temp/sitservice
然后運行就出現了上述的錯誤(我只改了web.config 的引用服務地址,別的沒改)。
解決:
把這個節點
<httpsTransport manualAddressing="false" maxBufferPoolSize="524288"
maxReceivedMessageSize="65536" allowCookies="false" authenticationScheme="Anonymous"
bypassProxyOnLocal="false" decompressionEnabled="true" hostNameComparisonMode="StrongWildcard"
keepAliveEnabled="true" maxBufferSize="65536" proxyAuthenticationScheme="Anonymous"
realm="" transferMode="Buffered" unsafeConnectionNtlmAuthentication="false"
useDefaultWebProxy="true" />
改為http的
<httpTransport manualAddressing="false" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" allowCookies="false" authenticationScheme="Anonymous" bypassProxyOnLocal="false" decompressionEnabled="true" hostNameComparisonMode="StrongWildcard" keepAliveEnabled="true" maxBufferSize="65536" proxyAuthenticationScheme="Anonymous" realm="" transferMode="Buffered" unsafeConnectionNtlmAuthentication="false" useDefaultWebProxy="true" />
重新編譯,運行成功。