基于SSL的WCF(URI方案"https"无效;预期为"http") [英] WCF over SSL (URI scheme 'https' is invalid; expected 'http')

查看:81
本文介绍了基于SSL的WCF(URI方案"https"无效;预期为"http")的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个与WCF服务通信的旧版Web应用程序.  在开发环境和测试环境下,它可以正常工作,但是在进入生产环境时,我们会遇到问题,因为生产环境需要使用SSL.

I have a legacy web app that communicates with a WCF service.  It works fine under a development environment and test environment, but when moving to production we have problems because production requires the use of SSL.

经过数小时的研究和多次失败的尝试,我编写了一个小型测试应用程序(基于Windows的应用程序),该应用程序连接到WCF服务,并对函数进行简单调用.我已验证这可以在SSL下使用.  所以看来 WCF服务已正确设置,而我的问题是正在尝试与其连接的Web应用.

After hours of research and multiple unsuccessful attempts, I wrote a small test app (a windows-based app) that connects to the WCF service, make a simple call to a function.  I have verified that this works under SSL.  So it would seem that the WCF service is set up correctly, and that my issue is the web app that is trying to connect with it.

这是我的WCF配置的一些摘录;

here's some excerpts from my WCF config;

        <client>
      <endpoint address="https://blahblah.com/MyService/myService.svc" binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_Service" contract="myService.ImyPermit" name="WSHttpBinding_Service" />
    </client>

      <wsHttpBinding>
        <binding name="WSHttpBinding_Service" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="10000000" maxReceivedMessageSize="10000000" messageEncoding="Text" useDefaultWebProxy="true" allowCookies="false">
          <readerQuotas maxDepth="1024" maxStringContentLength="16777216" maxArrayLength="16777216" maxBytesPerRead="16777216" maxNameTableCharCount="16777216" />
          <reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false" />
          <security mode="Transport">
            <transport clientCredentialType="None" proxyCredentialType="None" realm="">
              <extendedProtectionPolicy policyEnforcement="Never"/>
            </transport>
          </security>
        </binding>
      </wsHttpBinding>

及以下是尝试连接应用的web.config摘录;

and below are excerpts from the web.config for the app trying to connect;

    <client>
      <endpoint address="https://blahblah.com/ePermitService/ePermit.svc"
          binding="wsHttpBinding" bindingConfiguration="basic1" contract="myService.ImyPermit"
          name="basic1">
        <identity>
          <dns value="192.168.0.7" />
        </identity>
      </endpoint>
      </client>

    <bindings>
      <basicHttpBinding>
        <binding name="basic" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647">
          <security mode="None">
            <transport>
              <extendedProtectionPolicy policyEnforcement="Never" />
            </transport>
          </security>
        </binding>
      </basicHttpBinding>
      <wsHttpBinding>
        <binding name="basic1">
          <security mode="Transport">
            <transport clientCredentialType="None" />
          </security>
        </binding>
      </wsHttpBinding>
    </bindings>

为什么会出现以下错误以及如何解决:

why am I getting the following error and how do I resolve:

System.ArgumentException:提供的URI方案'https'无效;预期的"http".参数名称:通过at System.ServiceModel.Channels.HttpChannelFactory上的System.ServiceModel.Channels.TransportChannelFactory`1.ValidateScheme(通过Uri)

System.ArgumentException: The provided URI scheme 'https' is invalid; expected 'http'. Parameter name: via at System.ServiceModel.Channels.TransportChannelFactory`1.ValidateScheme(Uri via) at System.ServiceModel.Channels.HttpChannelFactory

推荐答案

嗨.

确保在生产环境中发布web.config.有时候是那样.

Be sure to publish the web.config in production. Some times its that.

干杯=)


这篇关于基于SSL的WCF(URI方案"https"无效;预期为"http")的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆