【问题标题】:Issue with https with webHttpBindinghttps 与 webHttpBinding 的问题
【发布时间】:2012-07-16 07:19:30
【问题描述】:

我在使用 webHttpBinding 实现 https 时遇到问题。我遇到了错误

找不到与具有绑定 WebHttpBinding 的端点的方案 https 匹配的基地址。注册的基地址方案是[http]

下面是我的 web.config 代码。请帮忙

<system.serviceModel>
<bindings>
  <webHttpBinding>
    <binding name="webHttpMobile" maxReceivedMessageSize="2147483647">
      <security mode="Transport">
        <transport clientCredentialType="None" />
      </security>
      <readerQuotas maxStringContentLength="2147483647" />
    </binding>
  </webHttpBinding>
</bindings>
<services>

  <service behaviorConfiguration="mybehavior"          name="SoIn.Services.MobileWebRole.Command">
    <endpoint address="mobile" behaviorConfiguration="web" binding="webHttpBinding"    bindingConfiguration="webHttpMobile" contract="SoIn.Services.MobileWebRole.ICommand" />
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
  </service>
  <service behaviorConfiguration="mybehavior" name="SoIn.Services.MobileWebRole.Query">
    <endpoint address="mobile" behaviorConfiguration="web" binding="webHttpBinding" bindingConfiguration="webHttpMobile" contract="SoIn.Services.MobileWebRole.IQuery" />
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
  </service>
  <service behaviorConfiguration="mybehavior" name="SoIn.Services.MobileWebRole.Configuration">
    <endpoint address="mobile" behaviorConfiguration="web" binding="webHttpBinding" bindingConfiguration="webHttpMobile" contract="SoIn.Services.MobileWebRole.IConfiguration" />
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
  </service>
</services>
<behaviors>
  <endpointBehaviors>
    <behavior name="web">
      <webHttp />
    </behavior>
  </endpointBehaviors>
  <serviceBehaviors>
    <behavior name="mybehavior">
      <serviceMetadata  httpsGetEnabled="true" />
      <serviceDebug includeExceptionDetailInFaults="true" />
    </behavior>
    <behavior name="">
      <serviceMetadata httpGetEnabled="true" />
      <serviceDebug includeExceptionDetailInFaults="false" />
    </behavior>
  </serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />

【问题讨论】:

  • 您收到什么错误信息?

标签: wcf


【解决方案1】:

试试下面提到的配置。

<system.serviceModel>
<bindings>
  <webHttpBinding>
    <binding name="webHttpMobile" maxReceivedMessageSize="2147483647">
      <security mode="Transport">
        <transport clientCredentialType="None" proxyCredentialType="None" realm="" />
        <message clientCredentialType="UserName" algorithmSuite="Default" />
      </security>
      <readerQuotas maxStringContentLength="2147483647" />
    </binding>
  </webHttpBinding>
</bindings>
<services>

  <service behaviorConfiguration="mybehavior"          name="SoIn.Services.MobileWebRole.Command">
    <endpoint address="mobile" behaviorConfiguration="web" binding="webHttpBinding"    bindingConfiguration="webHttpMobile" contract="SoIn.Services.MobileWebRole.ICommand" />
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
  </service>
  <service behaviorConfiguration="mybehavior" name="SoIn.Services.MobileWebRole.Query">
    <endpoint address="mobile" behaviorConfiguration="web" binding="webHttpBinding" bindingConfiguration="webHttpMobile" contract="SoIn.Services.MobileWebRole.IQuery" />
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
  </service>
  <service behaviorConfiguration="mybehavior" name="SoIn.Services.MobileWebRole.Configuration">
    <endpoint address="mobile" behaviorConfiguration="web" binding="webHttpBinding" bindingConfiguration="webHttpMobile" contract="SoIn.Services.MobileWebRole.IConfiguration" />
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
  </service>
</services>
<behaviors>
  <endpointBehaviors>
    <behavior name="web">
      <webHttp />
    </behavior>
  </endpointBehaviors>
  <serviceBehaviors>
    <behavior name="mybehavior">
      <serviceMetadata  httpsGetEnabled="true" />
      <serviceDebug includeExceptionDetailInFaults="true" />
    </behavior>
    <behavior name="">
      <serviceMetadata httpGetEnabled="true" />
      <serviceDebug includeExceptionDetailInFaults="false" />
    </behavior>
  </serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />

【讨论】:

  • 我复制并粘贴了你提供的内容,但仍然无法正常工作......现在我遇到了你提到的这个标签的问题
  • 我必须实现 mexHttpsBinding 和 webHttpsBinding 吗?
  • 你也可以试试。你有 吗?它必须在绑定配置中。
  • 我看不出这有什么帮助,它没有解释任何东西。如果可以,我会投反对票。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2013-01-15
  • 2019-10-25
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-06-27
  • 2011-07-14
相关资源
最近更新 更多