https与WCF错误:“无法find匹配scheme https的基地址”

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

(如果我使用http://,链接工作)

服务'/MyApp/MyService.svc'由于编译时出现exception而无法激活,例外情况是:找不到匹配scheme https的基地址,绑定BasicHttpBinding,注册的基地址模式为[http ] ..

编辑:所以如果我改变address="" address="https:// ..."然后我得到这个错误,而不是:

错误:协议”https“不支持…..” https://…/Annotation.svc “上带有合约”Annotation“的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> 

我有这个完全相同的问题。 除了我的解决scheme是添加一个“S”的绑定值。

Old: binding =“mexHttpBinding”

新增: binding =“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> 

事实certificate,我的问题是,我正在使用一个负载平衡器来处理SSL,然后通过HTTP发送到实际的服务器,然后抱怨。

修复的描述在这里: http : //blog.hackedbrain.com/2006/09/26/how-to-ssl-passthrough-with-wcf-or-transportwithmessagecredential-over-plain-http/

编辑:我解决了我的问题,这是略有不同,谈到微软的支持。

我的silverlight应用程序的代码端点地址通过https到负载平衡器。 然后,负载均衡器将端点地址更改为http,并指向它将要运行的实际服务器。 因此,在每个服务器的Webconfiguration中,我添加了一个listenUri作为http而不是https的端点

 <endpoint address="" listenUri="http://[LOAD_BALANCER_ADDRESS]" ... /> 

确保您的服务器已启用SSL!

我试图在本地没有该证书的盒子上使用HTTPSconfiguration文件时出现此错误。 我试图做本地testing – 通过将一些绑定从HTTPS转换为HTTP。 我认为这比尝试为本地testing安装一个自签名证书要容易得多。

原来我得到这个错误,因为我没有在我的本地IIS上启用S​​SL ,即使我不打算实际使用它。

在HTTPS的configuration中有一些东西。 在IIS7中创build一个自签名证书允许HTTP然后工作:-)

我想你正在试图configuration你的服务在类似的方式下面的configuration。 这里有更多的信息: 用两个端点使用不同的绑定值来指定一个服务 。 另外,除了开发之外,将HTTP和HTTPS端点都设置为相同的服务可能不是一个好主意。 它有点击败了HTTPS的目的。 希望这可以帮助!

 <service type="HelloWorld, IndigoConfig, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null"> <endpoint address="http://computer:8080/Hello" contract="HelloWorld, IndigoConfig, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null" binding="basicHttpBinding" bindingConfiguration="shortTimeout" </endpoint> <endpoint address="http://computer:8080/Hello" contract="HelloWorld, IndigoConfig, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null" binding="basicHttpBinding" bindingConfiguration="Secure" </endpoint> </service> <bindings> <basicHttpBinding name="shortTimeout" timeout="00:00:00:01" /> <basicHttpBinding name="Secure"> <Security mode="Transport" /> </basicHttpBinding> </bindings> 

在我的情况下,我在绑定中将安全模式设置为“TransportCredentialOnly”而不是“Transport”。 改变它解决了这个问题

 <bindings> <webHttpBinding> <binding name="webHttpSecure"> <security mode="Transport"> <transport clientCredentialType="Windows" ></transport> </security> </binding> </webHttpBinding> </bindings> 

我正在使用webHttpBinding,并忘记在导致错误的绑定configuration上指定“传输”的安全模式:

  <webHttpBinding> <binding name="MyWCFServiceEndpoint"> <security mode="Transport" /> </binding> </webHttpBinding> 

在configuration中添加这个修复了这个问题。

看看你的基地址和你的端点地址(不能在你的示例代码中看到它)。 很可能你错过了一列或其他一些错字,例如https //而不是https://