几年前,我在这篇RESTful WCF Services with No svc file and No config上非常有用的文章中介绍了如何在不使用svc文件的情况下设置RESTful WCF并像梦一样工作。但是最近我不得不将站点移到HTTPS(仍然保留HTTP进行测试),并且一切正常,直到我删除了HTTP站点的绑定并收到一条错误消息,该错误消息指向了Web中的此项.config:
<webHttpEndpoint>
<standardEndpoint name="" helpEnabled="true" automaticFormatSelectionEnabled="true"/>
</webHttpEndpoint>
删除条目可修复该错误,但会停止此设置提供的自动生成的帮助页面。
以下是抛出的2个错误的简短摘要:
异常: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行)
希望有人已经看到并解决了这个问题。
答案 0 :(得分:0)
想到了这个,所以我需要一个绑定,更新的web.config是这样的:
<bindings>
<webHttpBinding>
<binding>
<security mode="Transport" />
</binding>
</webHttpBinding>
</bindings>
<standardEndpoints>
<webHttpEndpoint>
<standardEndpoint name="" helpEnabled="true" automaticFormatSelectionEnabled="true" />
</webHttpEndpoint>
</standardEndpoints>