WCF异常: 提供的 URI 方案“https”无效,应为“http”。 参数名: via

前几天,在用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" />

重新编译,运行成功。

原文地址:https://www.cnblogs.com/for917157ever/p/4597551.html