-1

I'm having an odd issue where an api call to the web server is giving an error message. It's not happening on every computer that is calling the api, only a select few.

The odd part of this, I can pull down the database and data files and I do not get the message here. Another odd thing is that I can call the api from the same computer but calling a different method and it works fine. That leads me to believe that it's a problem with the method even though I can run it from here with the same setup.

enter image description here

I added logging to my api method and it shows that it is going through the process without any exceptions:

  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());
      }
    }

Any my log shows this:

==============================================================
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
==============================================================

I added wcf tracing and the logs shows these messages:

enter image description here

Here is the messages for those blind like me:

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

I'm not sure I understand the message or why it is happening.

Anyone have any suggestions?

***** UPDATE *****

I am adding info to see if it helps any.

Any my service mask to my method I am referencing:

[Inspector]
[FaultContract(typeof(DataAccessFaultContract))]
[WebInvoke(BodyStyle = WebMessageBodyStyle.Wrapped)]
[OperationContract(Name = "Get30DaysOfOfficeMessages")]
IEnumerable<OfficeMessage> Get30DaysOfOfficeMessages(Guid corporationId);
ErocM
  • 4,505
  • 24
  • 94
  • 161
  • That DTO ReturnMessage isn't used in that IEnumerable. Aren't you missing a mapping between that OfficeMessage type and the ReturnMessage type? – rene Sep 08 '19 at 12:51
  • @rene I must have thought that it was being used at the time. Apparently, it has no function here. – ErocM Sep 09 '19 at 13:49
  • Do the machines where it fails perhaps have a (slightly) different version of Office installed? From the error log, it looks like it might be an Office inter-op assembly version mismatch. – 500 - Internal Server Error Sep 09 '19 at 14:04
  • I don't have office installed on the server, it never has been. This was working at one time without issue. It seems to work with some companies, just not all. I cannot pint point what is causing specific companies to not work. – ErocM Sep 09 '19 at 14:37
  • Doesn't surprise me that this was down voted. I would expect nothing less from SO. – ErocM Oct 07 '19 at 20:11

1 Answers1

2

I found this post and it had the following line in it:

DbContext.Configuration.ProxyCreationEnabled = false;

Which fixed my issue.

ErocM
  • 4,505
  • 24
  • 94
  • 161