简体   繁体   English

C#Web API调用错误消息

[英]C# Web API Call Error Message

I am using the C# wrapper HaloEzAPI 我正在使用C#包装器HaloEzAPI

When I make a call using GetCustomPostGameCarnageReport I get the following error message. 当我使用GetCustomPostGameCarnageReport拨打电话时,收到以下错误消息。

It wasnt happening two days ago and just suddenly started. 这不是两天前发生的事情,而是突然开始的。

It says the error occurs on line 56 below. 它说错误发生在下面的第56行。 If anyone could help me with this it would be appreciated greatly. 如果有人可以帮助我,将不胜感激。

Number must be either non-negative and less than or equal to Int32.MaxValue or -1.
Parameter name: millisecondsTimeoutDescription: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ArgumentOutOfRangeException: Number must be either non-negative and less than or equal to Int32.MaxValue or -1.
Parameter name: millisecondsTimeout
Source Error:
Line 54: if (results.Id.MatchId != null)
Line 55: {
Line 56: var carnageReports = await _service.GetCustomPostGameCarnageReport(results.Id.MatchId);

I also get this error occasionally 我偶尔也会收到此错误

JSON integer 4294967295 is too large or small for an Int32. Path 'TeamStats[0].Score', line 1, position 2413.Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: Newtonsoft.Json.JsonReaderException: JSON integer 4294967295 is too large or small for an Int32. Path 'TeamStats[0].Score', line 1, position 2413.
Source Error:
Line 54: if (results.Id.MatchId != null)
Line 55: {
Line 56: var carnageReports = await _service.GetCustomPostGameCarnageReport(results.Id.MatchId);

According to errors that you provide: 根据您提供的错误:

  • second error description says very clear: value that json serialized tries to serialize as an integer is too big for it. 第二个错误描述说得很清楚:json序列化的值尝试序列化为整数,因为它太大了。 Actually, in your TeamStats[0].Score at the time of error occured you have value 4294967295 , but max int value in .net is 2147483647 . 实际上,在发生错误时您的TeamStats[0].Score中,您的值为4294967295 ,但.net中的最大int值为2147483647 So maybe it's better to use long instead of int (and even more instead of uint for not to be outside of its max value if you really have so big values); 因此,也许最好使用long而不是int (如果确实有这么大的值,则最好使用long而不是uint因为不要超出其最大值);

  • in my opinion, error from the first description is possibly related to the same problem with the int max value. 我认为,第一个描述中的错误可能与int max值的相同问题有关。 If it's possible to post more detailed stack trace of you timeout problem so we can try to dive deeper with it and help you 如果有可能发布有关您超时问题的更详细的堆栈跟踪信息,那么我们可以尝试更深入地研究它并为您提供帮助

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM