【问题标题】:RESTful WCF Service errors when hosted on HTTPS only仅在 HTTPS 上托管时出现 RESTful WCF 服务错误
【发布时间】:2018-09-19 09:21:24
【问题描述】:

几年前,我关注了这篇关于在不使用 svc 文件的情况下设置 RESTful WCF 的非常有用的文章 RESTful WCF Services with No svc file and No config,并且工作起来就像做梦一样。但是最近我不得不将站点移到 HTTPS(仍然保留 HTTP 进行测试)并且一切正常,直到我删除了 HTTP 站点的绑定并且我收到一条错误消息,指向网络中的这个条目.config:

<webHttpEndpoint>
<standardEndpoint name="" helpEnabled="true" automaticFormatSelectionEnabled="true"/>
</webHttpEndpoint>

删除该条目可修复错误,但会停止此设置提供的自动生成的帮助页面。

这里是抛出的 2 个错误的简要 sn-p:

异常:System.ServiceModel.ServiceActivationException:由于编译期间出现异常,无法激活服务“/myService”。异常消息是:找不到与绑定 WebHttpBinding 的端点的方案 http 匹配的基地址。注册的基地址方案是 [https].. ---> System.InvalidOperationException:找不到与绑定 WebHttpBinding 的端点的方案 http 匹配的基地址。注册的基地址方案是 [https]。

异常:System.ServiceModel.ServiceActivationException:由于编译期间出现异常,无法激活服务“/MyService”。异常消息是:在您的配置中检测到端点引用周期。必须删除以下引用循环:webHttpEndpoint/、webHttpEndpoint/。 (...\web.config 第 222 行)。 ---> System.Configuration.ConfigurationErrorsException:在您的配置中检测到端点引用周期。必须删除以下引用循环:webHttpEndpoint/、webHttpEndpoint/。 (...\web.config 第 222 行)

希望有人之前已经看到并解决了这个问题。

【问题讨论】:

  • 你能分享一下 ...\web.config 第 222 行哪里出错了The following reference cycle must be removed: webHttpEndpoint/, webHttpEndpoint/。还有什么是绑定使用的?
  • 这是第 222 行的内容:
  • 我想我已经找到了问题,我没有绑定条目,所以通过添加 似乎可以解决它,虽然我需要得到一个完整的集合完成的测试
  • 好的,太好了……

标签: vb.net rest wcf


【解决方案1】:

想通了,所以我需要一个绑定,更新后的 web.config 是这样的:

<bindings>
  <webHttpBinding>
    <binding>
      <security mode="Transport" />
    </binding>
  </webHttpBinding>
</bindings>


<standardEndpoints>
  <webHttpEndpoint>
    <standardEndpoint name="" helpEnabled="true" automaticFormatSelectionEnabled="true" />                 
  </webHttpEndpoint>
</standardEndpoints>

【讨论】:

  • 会做,但它不会让我这样做 2 天,所以会回来。 :-)
猜你喜欢
  • 2012-04-14
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-08-10
  • 1970-01-01
  • 1970-01-01
  • 2015-03-14
相关资源
最近更新 更多