42

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

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

服务'/MyApp/MyService.svc'由于编译过程中的异常而无法激活。异常消息是:找不到与绑定BasicHttpBinding的端点的方案https匹配的基地址。注册的基地址方案是[http ]..

编辑:所以如果我address=""改为address="https:// ..."然后我得到这个错误:

"错误:不支持协议 'https' ......' https://.../Annotation.svc ' 上的 ChannelDispatcher 与合同 '"Annotation"' 无法打开其 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>
4

7 回答 7

31

我有这个完全相同的问题。除了我的解决方案是在绑定值中添加一个“s”。

旧: 绑定 =“mexHttpBinding”

新: 绑定=“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>
于 2011-05-26T03:20:48.233 回答
20

事实证明,我的问题是我使用负载平衡器来处理 SSL,然后通过 http 将其发送到实际服务器,然后服务器抱怨。

修复说明如下:http: //blog.hackedbrain.com/2006/09/26/how-to-ssl-passthrough-with-wcf-or-transportwithmessagecredential-over-plain-http/

编辑:在与微软支持人员交谈后,我解决了我的问题,这略有不同。

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

<endpoint address="" listenUri="http://[LOAD_BALANCER_ADDRESS]" ... />
于 2009-01-19T19:11:44.630 回答
9

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

尝试在没有该证书的本地机器上使用 HTTPS 配置文件时出现此错误。我试图进行本地测试 - 通过将一些绑定从 HTTPS 转换为 HTTP。我认为这样做比尝试安装自签名证书进行本地测试更容易。

结果我收到了这个错误,因为我没有在我的本地 IIS 上启用 SSL,即使我并不打算实际使用它。

HTTPS 的配置中有一些内容。在 IIS7 中创建自签名证书允许 HTTP 工作:-)

于 2010-09-17T01:20:59.267 回答
3

我认为您正在尝试以与以下配置类似的方式配置您的服务。这里有更多信息:使用不同的绑定值指定具有两个端点的服务。此外,除了开发之外,将 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>
于 2008-12-12T22:00:46.080 回答
1

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

<bindings>
  <webHttpBinding>
    <binding name="webHttpSecure">
      <security mode="Transport">
        <transport clientCredentialType="Windows" ></transport>
      </security>
      </binding>
  </webHttpBinding>
</bindings>
于 2012-04-05T07:49:21.937 回答
0

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

于 2011-07-28T16:39:47.570 回答
0

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

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

在配置中添加这个解决了这个问题。

于 2012-02-01T20:37:50.600 回答