我試圖解析電子郵件使用網絡掛接功能,但只得到下面的錯誤從電網送進來的...Sendgrid入站網絡掛接使用Web API升C
「時發生錯誤。」 ,「ExceptionMessage」:「解析數字:W路徑'',第1行,第6位遇到意外的字符。」,「ExceptionType」:「Newtonsoft.Json.JsonReaderException」,「StackTrace」:「at Newtonsoft.Json.JsonTextReader .ReadNumberCharIntoBuffer(CHAR currentChar,的Int32 charPos個)\ r \ n在Newtonsoft.Json.JsonTextReader.ReadNumberIntoBuffer(個)\ r \ n在Newtonsoft.Json.JsonTextReader.ParseNumber(readType readType個)\ r \ n在Newtonsoft.Json.JsonTextReader。 ParseValue()\ r \ n在Newtonsoft.JsonTextReader.Read()\ r \ n在Newtonsoft.Json.JsonReader.ReadForType(JsonCon道合同,布爾hasConverter個)\ r \ n在Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader讀卡器,類型的objectType,布爾checkAdditionalContent個)\ r \ n在Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader讀卡器,類型的objectType)\ r \ n在Newtonsoft.Json.JsonConvert.DeserializeObject(字符串值,類型類型,JsonConverter []轉換器)\ r \ n在Newtonsoft.Json.JsonConvert.DeserializeObject(字符串值,類型類型,JsonSerializerSettings設置)\ r \ n at Newtonsoft.Json.JsonConvert.DeserializeObject [T](字符串值,JsonConverter []轉換器)\ r \ n在用C StrongGrid.WebhookParser.ParseWebhookEvents(字符串requestBody):\項目\ stronggrid \源\ strongGrid \ WebhookParser.cs:線C:\ Dev \ Baxter Personnel \ Projects \ Comms \ WebAPI_InboundMail \ WebAPI_InboundMail \ Controllers \ HomeController.cs中的WebAPI_InboundMail.Controllers.HomeController.d__0.MoveNext()中的48 \ r \ n:第23行\ r \ n --- End來自先前位置拋出異常的堆棧跟蹤--- \ r \Ñ在System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任務任務個)\ r \ n在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任務任務個)\ r \ n在System.Threading.Tasks.TaskHelpersExtensions.d__3` 1.MoveNext()\ r \ n ---來自之前引發異常的位置的堆棧跟蹤結束--- \ r \ n在System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任務任務)\ r \ n在System .Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任務任務)\ r \ n在System.Web.Http.Controllers.ApiControllerActionInvoker.d__0.MoveNext()\ r \ n ---從以前的位置拋出異常的堆棧跟蹤結束--- \ r \ n在System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任務任務)\ r \ n在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任務任務)\ r \ n在System.Web.Http。 Controllers.ActionFilterResult.d__2.MoveNext()\ r \ n ---來自以前位置的堆棧跟蹤結束,其中異常是thro WN --- \ r \ n在System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(任務任務)\ r \ n在System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(任務任務)\ r \ n在System.Web.Http .Dispatcher.HttpControllerDispatcher.d__1.MoveNext()「}
這裏是我的代碼,任何幫助是巨大的......
[HttpPost]
public async Task<IHttpActionResult> Post()
{
var requestBody = await Request.Content.ReadAsStringAsync();
var parser = new WebhookParser();
var events = parser.ParseWebhookEvents(requestBody);
bool status = true;
var response = status == true? new HttpResponseMessage(HttpStatusCode.OK) : new HttpResponseMessage(HttpStatusCode.BadRequest);
return Ok("");
}