wcf - https 带有 WCF 错误 : "Could not find base address that matches scheme https"

标签 wcf https

我去https://mywebsite/MyApp/Myservice.svc并得到以下错误:

(如果我使用 http://,则该链接有效)

由于编译期间出现异常,无法激活服务“/MyApp/MyService.svc”。异常消息为:无法找到与绑定(bind) BasicHttpBinding 的端点的方案 https 相匹配的基地址。已注册基地址方案是 [http].."

编辑:因此,如果我将 address="" 更改为 address="https://..." 那么我会得到这个错误改为:

错误:不支持协议(protocol)“https”......位于“https://.../Annotation.svc”且合约“注释”的 ChannelDispatcher 无法打开其 IChannelListener。

这是我的 Web.Config 的样子:

<services>
      <service behaviorConfiguration="AnnotationWCF.AnnotationBehavior"
              name="AnnotationWCF.Annotation">
              <endpoint address="" binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_Annotation"
                      contract="AnnotationWCF.Annotation" />
              <endpoint address="" 
                  binding="basicHttpBinding" bindingConfiguration="SecureTransport"
                  contract="AnnotationWCF.Annotation" />
              <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
      </service>

<bindings>
<basicHttpBinding>
    <binding name="BasicHttpBinding_Annotation" maxBufferSize="2147483647"
            maxReceivedMessageSize="2147483647">
        <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
            maxArrayLength="2147483647" maxBytesPerRead="2147483647"
            maxNameTableCharCount="2147483647" />
    </binding>
    <binding name="SecureTransport" maxBufferSize="2147483647"
            maxReceivedMessageSize="2147483647">
        <security mode="Transport">
        <transport clientCredentialType="None"/>
        </security>
        <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647"
            maxArrayLength="2147483647" maxBytesPerRead="2147483647"
            maxNameTableCharCount="2147483647" />
    </binding>
</basicHttpBinding>

最佳答案

我也遇到了同样的问题。除了我的解决方案是在绑定(bind)值中添加一个“s”。

旧版: 绑定(bind)=“mexHttpBinding”

新: 绑定(bind)=“mexHttpsBinding”

web.config 片段:

<services>
    <service behaviorConfiguration="ServiceBehavior" name="LIMS.UI.Web.WCFServices.Accessioning.QuickDataEntryService">
        <endpoint behaviorConfiguration="AspNetAjaxBehavior" binding="webHttpBinding" bindingConfiguration="webBinding" 
            contract="LIMS.UI.Web.WCFServices.Accessioning.QuickDataEntryService" />
        <endpoint address="mex" binding="mexHttpsBinding" contract="IMetadataExchange" />
    </service>

关于wcf - https 带有 WCF 错误 : "Could not find base address that matches scheme https",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/363285/

相关文章:

c# - 更新服务引用在 WCF 中不起作用

c# - 从 Web 服务返回域对象

c# - 使用 ASP.NET MVC 应用程序从 HTTPS 重定向

go - GCP => 监听 TCP :443: bind: permission denied

google-app-engine - Appengine 谷歌云自定义域。无法包含证书,无法删除域。为什么?

c# - WCF中MinFreeMemoryPercentageToActivateService的意义是什么?

java - 从android解析jsonObject并在webservice vb.net中获取它

Java:sun.security.provider.certpath.SunCertPathBuilderException:无法找到请求目标的有效证书路径

Magento 为安全区域创建非 SSL 链接

wcf - 如何自动化/安排托管在 IIS 中的 WCF 服务调用?