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.
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:
Here is the messages for those blind like me:
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);
I found this post and it had the following line in it:
DbContext.Configuration.ProxyCreationEnabled = false;
Which fixed my issue.