2017-09-27 18 views
0

私はAzure Webアプリケーション.NET(4.6.1)/c#/MVC5/EF/Newtonsoft.JSON(6.0.4)を1週間は正常に実行してから、青色から500エラーまで実行します誰にとっても使えなくなってしまいます。サイトの再起動やリサイクルは、サイトを元気に戻します。私は根本的な原因を見つけるのに苦労しています。私はいくつかのスレッドを見てきましたが、これは、アプリケーションプールのタイミングの悪いリサイクルがこの現象を引き起こす可能性があることを示唆しています。ただし、IISでは、サイトはリサイクルされないように構成されています(アイドルタイムアウト= 0、リサイクルスケジュールは0に設定されています)。誰かがこれを経験したことがありますか?c#/ .net/EF/MVC5サイトで断続的な500シリアル化エラーが発生する原因は何ですか?

{"Message":"An error has occurred.","ExceptionMessage":"The 'ObjectContent`1' type failed to serialize the response body for content type 'application/json; charset=utf-8'.","ExceptionType":"System.InvalidOperationException","StackTrace":null,"InnerException":{"Message":"An error has occurred.","ExceptionMessage":"Error getting value from 'IsCompleted' on 'Weaver.TruckScaleMgmt.Common.Models.TruckLoad'.","ExceptionType":"Newtonsoft.Json.JsonSerializationException","StackTrace":" at Newtonsoft.Json.Serialization.DynamicValueProvider.GetValue(Object target)\r\n at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.CalculatePropertyValues(JsonWriter writer, Object value, JsonContainerContract contract, JsonProperty member, JsonProperty property, JsonContract& memberContract, Object& memberValue)\r\n at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeObject(JsonWriter writer, Object value, JsonObjectContract contract, JsonProperty member, JsonContainerContract collectionContract, JsonProperty containerProperty)\r\n at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.SerializeValue(JsonWriter writer, Object value, JsonContract valueContract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerProperty)\r\n at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.Serialize(JsonWriter jsonWriter, Object value, Type objectType)\r\n at Newtonsoft.Json.JsonSerializer.SerializeInternal(JsonWriter jsonWriter, Object value, Type objectType)\r\n at System.Net.Http.Formatting.BaseJsonMediaTypeFormatter.WriteToStream(Type type, Object value, Stream writeStream, Encoding effectiveEncoding)\r\n at System.Net.Http.Formatting.JsonMediaTypeFormatter.WriteToStream(Type type, Object value, Stream writeStream, Encoding effectiveEncoding)\r\n at System.Net.Http.Formatting.BaseJsonMediaTypeFormatter.WriteToStream(Type type, Object value, Stream writeStream, HttpContent content)\r\n at System.Net.Http.Formatting.BaseJsonMediaTypeFormatter.WriteToStreamAsync(Type type, Object value, Stream writeStream, HttpContent content, TransportContext transportContext, CancellationToken cancellationToken)\r\n--- End of stack trace from previous location where exception was thrown ---\r\n at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)\r\n at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n at System.Web.Http.WebHost.HttpControllerHandler.d__1b.MoveNext()","InnerException":{"Message":"An error has occurred.","ExceptionMessage":"Object reference not set to an instance of an object.","ExceptionType":"System.NullReferenceException","StackTrace":" at Weaver.TruckScaleMgmt.Common.Models.TruckLoad.<>c.b__71_0(TruckLoadQuality t) in C:\Users\wh741\Source\Repos\Scalehouse\Weaver.TruckScaleMgmt.Common\Models\TruckLoad.cs:line 223\r\n at System.Linq.Enumerable.WhereListIterator`1.MoveNext()\r\n at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)\r\n at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)\r\n at Weaver.TruckScaleMgmt.Common.Models.TruckLoad.UpdateCompletedRequirements() in C:\Users\wh741\Source\Repos\Scalehouse\Weaver.TruckScaleMgmt.Common\Models\TruckLoad.cs:line 223\r\n at Weaver.TruckScaleMgmt.Common.Models.TruckLoad.get_IsCompleted() in C:\Users\wh741\Source\Repos\Scalehouse\Weaver.TruckScaleMgmt.Common\Models\TruckLoad.cs:line 335\r\n at GetIsCompleted(Object)\r\n at Newtonsoft.Json.Serialization.DynamicValueProvider.GetValue(Object target)"}}}

以下はエラーの言い回しです。 。 。

アップデート:私は、問題を再現することができて、それはブール変数のシリアライズの問題であることを信じていました

。私はまだそれを修正していないが、私は根本的な原因を知っていると信じています。私は以前の投稿コード根本原因に関連していなかった....

アップデート2:

OK。私は問題を修正しました。青い月に一度発生した場合は、linqクエリ内のフィールド内にnull値が残っています。しかし、私が知りませんが、これは、誰もがアプリを使用できなくする理由です。 1つのインスタンスは、誰もがアプリのかつらを作る.....

+0

だから 'IsCompleted'と' UpdateCompletedRequirements() 'では何が起こるのですか?あなたはそこにNREを持っています。 –

+0

以下のquality.whereステートメントで失敗します。しかし、これは症状だと思います。 99%の時間で正常に動作します。 – elletek

+0

コントローラメソッドからどのような出力が期待されていますか?出力がjsonにシリアル化されていないようです。それはエラーです –

答えて

1

私は問題を修正しました。青い月に一度発生した場合は、linqクエリ内のフィールド内にnull値が残っています。しかし、私が知りませんが、これは、誰もがアプリを使用できなくする理由です。 1つのインスタンスは、誰もがアプリのかつらを作る.....

関連する問題