WCF - “没有端点正在侦听...”错误

2023-11-23

我想在同一台计算机上本地测试两个应用程序。应用程序 1 有一个简单的 WCF 服务,具有以下配置条目:

<service behaviorConfiguration="MyNamespace.ContainerManagementServiceBehavior"
        name="MyNamespace.ContainerManagementService">
  <endpoint address="ContainerManagementService" binding="basicHttpBinding"
     name="ContainerManagementbasicHttpEndpoint"
     contract="MyNamespace.IContainer" />
  <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
  <host>
    <baseAddresses>
      <add baseAddress="http://localhost:8000/ContainerManagementService" />
    </baseAddresses>
  </host>
</service>    
<behaviors>      
  <behavior name="MyNamespace.ContainerManagementServiceBehavior">
    <serviceMetadata httpGetEnabled="true" />
    <serviceDebug includeExceptionDetailInFaults="false" />
  </behavior>
</behaviors>

我通过运行托管该服务的 Web 应用程序项目来启动该服务。我能够成功浏览到该 url 并从 ie 获取 Web 服务信息页面。我复制相同的 URL 并将其用于我的客户端。

我的另一个客户端 App 2 在其配置文件中包含以下内容:

<system.serviceModel>
  <bindings>
    <basicHttpBinding>
      <binding name="basicHttp" closeTimeout="00:10:00"
        openTimeout="00:10:00" receiveTimeout="00:10:00"
        sendTimeout="00:10:00" allowCookies="false"
        bypassProxyOnLocal="false"
        hostNameComparisonMode="StrongWildcard"
        maxBufferSize="5242880" maxBufferPoolSize="524288"
        maxReceivedMessageSize="5242880" messageEncoding="Text"
        textEncoding="utf-8" transferMode="Buffered"
        useDefaultWebProxy="true">
      <readerQuotas maxDepth="32" maxStringContentLength="8192"
          maxArrayLength="16384"
          maxBytesPerRead="4096" maxNameTableCharCount="5242880" />
        <security mode="None">
          <transport clientCredentialType="None"
            proxyCredentialType="None" realm="" />
          <message clientCredentialType="UserName" algorithmSuite="Default" />
        </security>
      </binding>
    </basicHttpBinding>
  </bindings>
  <client>
    <endpoint
      address="http://localhost:3227/Services/ContainerManagementService.svc"
      binding="basicHttpBinding" bindingConfiguration="basicHttp"
      contract="MyService.IService" name="externalService" />      
  </client>
</system.serviceModel>

但是,当我尝试从客户端向正在运行的服务执行 WCF 调用时,我收到以下错误消息:

There was no endpoint listening at
http://localhost:3227/Services/ContainerManagementService.svc
that could accept the message. This is often caused by an incorrect
address or SOAP action. See InnerException, if present, for more details.

可能会发生什么?


看起来这个问题是由于服务器和客户端都是从卡西尼服务器运行的事实造成的。我正在更改架构以在 IIS 中托管服务器端点。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

WCF - “没有端点正在侦听...”错误 的相关文章

随机推荐