服务参考在某些计算机上有效,但在所有计算机上无效,出现我不理解的错误

Service reference works on some computers but not all, getting an error that I do not understand

我遇到了一个奇怪的问题,即对 Web 服务器的 api 调用给出了一条错误消息。并非每台调用 api 的计算机都会发生这种情况,只有少数 select 会发生。

奇怪的是,我可以下载数据库和数据文件,但我没有收到这里的消息。另一件奇怪的事情是我可以从同一台计算机调用 api 但调用不同的方法并且它工作正常。这让我相信这是方法的问题,尽管我可以从这里使用相同的设置 运行 它。

我在我的 api 方法中添加了日志记录,它表明它正在无一例外地完成整个过程:

  public IEnumerable<OfficeMessage> Get30DaysOfOfficeMessages(Guid corporationId)
    {
      var sb = new StringBuilder();

      try
      {
        sb.AppendLine("************* FRED *************");
        sb.AppendLine("Starting Get30DaysOfOfficeMessages");
        sb.AppendLine($"CorporationId: {corporationId}");

        var getdate = DateTime.Now.AddDays(-30);
        sb.AppendLine($"GetDate: {getdate}");

        var qry = (from g in _entities.OfficeMessages
          where g.CorporationId == corporationId &&
                g.MessageDateTime > getdate
          orderby g.MessageDateTime descending
          select g).ToList();

          sb.AppendLine($"Records found: {qry.Count}");
          return qry;
      }
      catch (Exception ex)
      {
        sb.AppendLine(GetFullExceptionMessage(ex));
        Logging2.WriteException(System.Reflection.MethodBase.GetCurrentMethod().Name, ex);
        return new List<OfficeMessage>();
      }
      finally
      {
        sb.AppendLine("Finished Get30DaysOfOfficeMessages");
        Logging2.WriteLog(sb.ToString());
      }
    }

我的任何日志都显示:

==============================================================
9/6/2019 10:52:26 AM
************* FRED *************
Starting Get30DaysOfOfficeMessages
CorporationId: 5d6bf36b-3fb8-425f-9c0c-4b2b609cf7f1
GetDate: 8/7/2019 10:52:26 AM
Records found: 6
Finished Get30DaysOfOfficeMessages
==============================================================

我添加了 wcf 跟踪并且日志显示了这些消息:

这里是给像我这样的盲人的信息:

  1. https://pastebin.com/UhqzQeHT
  2. https://pastebin.com/v8xDQRDs
  3. https://pastebin.com/cMKhDY6i

我不确定我是否理解消息或它发生的原因。

有人有什么建议吗?

***** 更新 *****

我正在添加信息以查看是否有帮助。

我引用的方法的任何服务掩码:

[Inspector]
[FaultContract(typeof(DataAccessFaultContract))]
[WebInvoke(BodyStyle = WebMessageBodyStyle.Wrapped)]
[OperationContract(Name = "Get30DaysOfOfficeMessages")]
IEnumerable<OfficeMessage> Get30DaysOfOfficeMessages(Guid corporationId);

我找到了 this post 并且其中包含以下行:

DbContext.Configuration.ProxyCreationEnabled = false;

这解决了我的问题。