我去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/