【问题标题】:Error with WCF. Could not find a base address that matches scheme http for the endpoint with binding WSHttpBindingWCF 出错。找不到与绑定 WSHttpBinding 的端点的方案 http 匹配的基地址
【发布时间】:2015-06-30 23:33:22
【问题描述】:

总的来说,我是构建 Web 服务和 WCF 的新手,虽然到目前为止我做得很好,但我遇到了以下问题,我似乎无法解决。

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

我的 app.config 是这样设置的

    <?xml version="1.0" encoding="utf-8" ?>
    <configuration>

      <system.web>
        <compilation debug="true" targetFramework="4.0" />
      </system.web>
      <system.serviceModel>
        <bindings>
          <wsHttpBinding>
            <binding name="WcfSoapServiceBinding">
              <security mode="None" />
            </binding>
          </wsHttpBinding>
        </bindings>
        <behaviors>
          <serviceBehaviors>
            <behavior name="WcfSoapServiceBehavior">
              <serviceMetadata httpGetEnabled="true" />
              <serviceDebug includeExceptionDetailInFaults="true" />
            </behavior>
          </serviceBehaviors>
        </behaviors>
        <services>
          <service behaviorConfiguration="WcfSoapServiceBehavior" name="WcfSoapService.Service1">
            <endpoint binding="wsHttpBinding" bindingConfiguration="WcfSoapServiceBinding"
              contract="WcfSoapService.IService1" />
          </service>
        </services>
      </system.serviceModel>
      <system.webServer>
        <modules runAllManagedModulesForAllRequests="true"/>
      </system.webServer>
    </configuration>

我将安全模式设置为“无”,因此它使用 HTTP 而不是 HTTPS,并且我还将 httpGetEnabled 设置为 true。我已经尝试了一些我在网上找到的不同选项,但到目前为止没有任何帮助。我正在使用 Ewald Hofman 关于如何使用 WCF 订阅 TFS 的示例。

http://www.ewaldhofman.nl/post/2010/08/02/How-to-use-WCF-to-subscribe-to-the-TFS-2010-Event-Service-rolling-up-hours.aspx

我觉得我很接近,但这是我无法克服的一件事。我的最终目标是从 TFS 获取 Soap 请求并解析其数据。作为 WCF 和 Web 服务器的新手,我不确定这个错误实际上告诉我什么也是错误的。所以我有两个问题。

1) 这个错误是什么意思是错误的?更具体地说,“注册的基地址方案是 []”是什么意思。

2) 我该如何解决这个错误?

【问题讨论】:

  • 您没有为端点指定地址 - 您是在 IIS 中托管服务还是自托管?

标签: c# web-services wcf tfs wshttpbinding


【解决方案1】:

在您的服务部分添加基地址或为您的端点添加地址元素。

 <services>
          <service behaviorConfiguration="WcfSoapServiceBehavior" name="WcfSoapService.Service1">

         <host>
          <baseAddresses>
            <add baseAddress="http://localhost:8182/MyService"/>
          </baseAddresses>
        </host>

            <endpoint address=""
 binding="wsHttpBinding" bindingConfiguration="WcfSoapServiceBinding"
              contract="WcfSoapService.IService1" />
          </service>

【讨论】:

  • 添加服务失败。服务元数据可能无法访问。确保您的服务正在运行并公开元数据。
  • 添加另一个端点以公开有关您的服务的元数据。
  • 不幸的是,同样的错误,但我会尝试其他一些端点,因为我还没有尝试过这个解决方案。
猜你喜欢
  • 2011-10-14
  • 1970-01-01
  • 1970-01-01
  • 2023-03-31
  • 1970-01-01
  • 1970-01-01
  • 2013-11-23
  • 1970-01-01
  • 2020-06-02
相关资源
最近更新 更多