下面的代码段中,我们编写了称为Web Api的代码。 服务会在“开发和质量检查”区域中返回预期的JSON数据。但是在生产中抛出以下错误。 错误情况:同一页面的许多地方我们调用了相同的不同Web api方法。第一次调用的时间很好,并提供了Json数据。在同一屏幕上的第二次呼叫将引发以下错误。 在所有地区的开发,AQ和生产中运行的构建版本相同。
try
{
string parameterURI = "ApmApps/" + AppId;
RestClient client = new RestSharp.RestClient(urlApp360);
client.Authenticator = new NtlmAuthenticator();
RestRequest request = new RestSharp.RestRequest(parameterURI, Method.GET);
IRestResponse response = client.Execute(request);
string result = response.Content;
return !string.IsNullOrEmpty(result) ? JsonConvert.DeserializeObject<AllEAIInformation>(result) : null;
}
catch (Exception ex)
{
throw;
}
错误详细信息:
Newtonsoft.Json.JsonReaderException Unexpected character encountered
while parsing value: <. Path '', line 0, position 0.
Newtonsoft.Json.JsonReaderException: Unexpected character encountered
while parsing value: <. Path '', line 0, position 0. at
Newtonsoft.Json.JsonTextReader.ParseValue() at
Newtonsoft.Json.JsonReader.ReadAndMoveToContent() at
Newtonsoft.Json.JsonReader.ReadForType(JsonContract contract, Boolean
hasConverter) at
ISLA.Web.Controllers.CreateRequestController.GetAllApps() at
ISLA.Web.Controllers.CreateRequestController.CreateIndex(String Req)
at lambda_method(Closure, ControllerBase, Object[])
at ISLA.Web.Controllers.CreateRequestController.GetAllApps()
at ISLA.Web.Controllers.CreateRequestController.CreateIndex(String Req)
at lambda_method(Closure , ControllerBase , Object[] )
at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary2 parameters)
at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c.<BeginInvokeSynchronousActionMethod>b__9_0(IAsyncResult asyncResult, ActionInvocation innerInvokeState)
at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`2.CallEndDelegate(IAsyncResult asyncResult)
at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<InvokeActionMethodFilterAsynchronouslyRecursive>b__11_0()
at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<>c__DisplayClass11_1.<InvokeActionMethodFilterAsynchronouslyRecursive>b__2()
at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass3_6.<BeginInvokeAction>b__3()
at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass3_1.<BeginInvokeAction>b__5(IAsyncResult asyncResult)