【问题标题】:WCF Could not find endpoint time to timeWCF 有时找不到端点
【发布时间】:2016-02-23 09:01:50
【问题描述】:

找不到引用合约的默认端点元素 ServiceModel 客户端中的“XXXServiceReference.XXXService” 配置部分。这可能是因为没有配置文件 为您的应用程序找到,或者因为没有匹配的端点元素 该合同可以在客户端元素中找到。

例外,但是我有时会收到此错误(1/3 失败)这里的问题可能是我的配置文件

 <system.serviceModel>
    <client>
      <endpoint address="http://address:8091/XXXService.svc"
        binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IXXXService"
        contract="XXXServiceReference.IXXXService" name="BasicHttpBinding_IXXXService" />
    </client>
    <bindings>
      <basicHttpBinding>
        <binding name="BasicHttpBinding_IXXXService" />
      </basicHttpBinding>
    </bindings>
  </system.serviceModel>

我将我的服务定义为

private XXXServiceClient sClient;

 bool success = false;
 int numOfEntrance = 0;
 while (!success && (numOfEntrance < 20))
 {
      numOfEntrance++;
      try
      {
           sClient = new XXXServiceClient();
           success = true;
      }
      catch (Exception)
      {
          success = false;
          Thread.Sleep(500);
          if (numOfEntrance == 19)
          MessageBox.Show("Connection Problem");
      }
  }

我试过这个,因为它会不时进入。我认为虽然可能是摆脱这个问题的机会,但它没有。可能是什么问题?可能是因为服务提供商。顺便说一句,我试图从合同中删除“XXXServiceClient”部分,但它没有用。

【问题讨论】:

  • 您如何托管服务? IIS?
  • 服务由另一家公司编写。他们告诉我们他们正在使用 IIS。将此服务用作 Web 服务是否是个好主意?

标签: c# wpf wcf endpoint


【解决方案1】:

我怀疑这是由于 IIS 主机不稳定或主机站点空闲,然后必须在下一次调用时进行预热。以下帖子介绍了如何将 IIS applicationHost.config 配置为自动启动:

http://weblogs.asp.net/scottgu/auto-start-asp-net-applications-vs-2010-and-net-4-0-series

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-04-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-12-10
    • 2010-12-30
    相关资源
    最近更新 更多