【问题标题】:Could not find a base address that matches scheme http for the endpoint with binding WSHttpBinding找不到与绑定 WSHttpBinding 的端点的方案 http 匹配的基地址
【发布时间】:2011-10-14 08:00:02
【问题描述】:

我在本地计算机上使用 wcf 用户名/密码身份验证,使用自签名证书,一切正常,但是当我将应用程序放在 IIS 7.5 和 windows server 2008 R2 上时,它给了我错误:
找不到与绑定 WSHttpBinding 的端点的方案 http 匹配的基地址。注册的基地址方案是 [https]。 我的网络服务配置文件:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.serviceModel>
<behaviors>
  <serviceBehaviors>
    <behavior name="ServiceCredentialsBehavior">
      <serviceCredentials>
        <serviceCertificate findValue="cn=AmicCert" storeName="Root" storeLocation="LocalMachine" />
        <userNameAuthentication userNamePasswordValidationMode="Custom" customUserNamePasswordValidatorType="Util.CustomUserNameValidator, Util" />
      </serviceCredentials>
      <serviceMetadata httpGetEnabled="true" />
    </behavior>
  </serviceBehaviors>
</behaviors>
<services>
  <service behaviorConfiguration="ServiceCredentialsBehavior" name="Service">
    <endpoint address="" binding="wsHttpBinding" bindingConfiguration="MessageAndUserName" name="SecuredByTransportEndpoint" contract="IService" />
  </service>
</services>
<bindings>
  <wsHttpBinding>
    <binding name="MessageAndUserName">
      <security mode="Message">
        <message clientCredentialType="UserName" />
      </security>
    </binding>
  </wsHttpBinding>
</bindings>
      <client />
   </system.serviceModel>
  <system.web>
<compilation debug="true" />
 </system.web>
 </configuration>

【问题讨论】:

标签: c# .net xml wcf https


【解决方案1】:

如果您不想对端点使用 HTTPS/SSL,Drew 的回答是正确的。

如果您确实想通过端点使用 SSL,则需要更改您的:

<security mode="Message">

到:

<security mode="TransportWithMessageCredential">

【讨论】:

    【解决方案2】:

    要让它工作并且仍然让 IIS 需要 SSL,您需要在配置文件中的端点中进行一些更改:使用 https (https://...) 和 @ 将 address 属性设置为服务的地址将 987654323@ 属性添加到带有 http (http://...) 的服务地址。这适用于wsHttpbasicHttp

    【讨论】:

    • 我的端点中没有指定协议,所以不是这样。
    【解决方案3】:

    听起来您托管的 IIS 网站实例仅针对 HTTPS (SSL) 进行了配置。右键单击网站实例并选择“编辑绑定...”。您看到那里列出了端口 80(纯 HTTP)吗?还要检查“SSL 设置”功能以确保“始终需要”选项未打开。

    【讨论】:

    • 只有一个绑定,即端口 8010(端口转发),我应该创建另一个 80 端口且没有 https 的绑定吗?
    • 端口无关紧要,但必须有一个非 HTTPS/SSL 地址绑定到站点,因为您没有在配置中使用传输安全(仅消息安全)。
    • 您的 AmiCert 证书不得安装在服务器上的商店中。
    • 我有一个 WCF 服务,它与服务器证书、客户端消息身份验证(用户/密码)完美配合,然后在我更新服务器证书后停止工作,显示此错误。我只更改了服务器配置上的指纹。有人遇到过吗?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2023-03-31
    • 1970-01-01
    • 2020-06-02
    • 1970-01-01
    • 2021-07-29
    • 1970-01-01
    • 2015-07-21
    相关资源
    最近更新 更多