服务器返回的信息无效或无法识别的响应,c# - 服务器从Visual Studio返回了无效或无法识别的响应错误 - 堆栈内存溢出...

这很奇怪,来自微软。 在Visual Studio中,当我从Visual Studio执行应用程序代码时,大多数时候都会收到以下错误,然后将代码发布到自己的服务器上,Web应用程序运行正常(发出请求时没有任何错误),并且从我的PC(与Visual Studio所在的PC是同一台PC)上,我向soapUI发出了相同的请求,我从调用的服务器URL中没有收到任何错误。 为什么我从Visual Studio中收到此错误,然后解决此问题。

出于安全原因,我无法提供该网址。

System.AggregateException

HResult=0x80131500

Message=One or more errors occurred. (An error occurred while sending the request.)

Source=System.Private.CoreLib

Arborescence des appels de procédure :

at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)

at Amadeus.Endpoint.call(String body) in C:\Users\Gervil Doubal\source\repos\Acompa chart\Amadeus\Endpoint.cs:line 175

at Amadeus.EndpointGeneric`2.call() in C:\Users\Gervil Doubal\source\repos\Acompa chart\Amadeus\EndpointGeneric.cs:line 32

at OnlineAgency.Controllers.CarController.userInfo() in C:\Users\Gervil Doubal\source\repos\Acompa chart\OnlineAgency\Controllers\CarController.cs:line 402

at Microsoft.Extensions.Internal.ObjectMethodExecutor.Execute(Object target, Object[] parameters)

at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.d__12.MoveNext()

Exception interne 1 :

HttpRequestException : An error occurred while sending the request.

Exception interne 2 :

WinHttpException : Le serveur a renvoyé une réponse non valide ou non reconnue

InnerException:

{System.Net.Http.HttpRequestException: An error occurred while sending the request. ---> System.Net.Http.WinHttpException: Le serveur a renvoyé une réponse non valide ou non reconnue

at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Threading.Tasks.RendezvousAwaitable`1.GetResult() at System.Net.Http.WinHttpHandler.d__105.MoveNext() --- End of inner exception stack trace --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult() at System.Net.Http.DiagnosticsHandler.d__2.MoveNext()--- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult() at System.Net.Http.HttpClient.d__58.MoveNext()--- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult() at Amadeus.Endpoint.<_call>d__33.MoveNext() in C:\Users\Gervil Doubal\source\repos\Acompa chart\Amadeus\Endpoint.cs:line 131}

消息: An error occurred while sending the request.

来源: "System.Private.CoreLib"

其他InnerException:

{System.Net.Http.WinHttpException (0x80072F78): Le serveur a renvoyé une réponse non valide ou non reconnue (The server returned an invalid or unrecognized response)

at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()

at System.Threading.Tasks.RendezvousAwaitable`1.GetResult()

at System.Net.Http.WinHttpHandler.d__105.MoveNext()}

错误代码: -2147012744

NativeCodeError: 12152

来源: "System.Private.CoreLib"

堆栈跟踪:

" at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Threading.Tasks.RendezvousAwaitable`1.GetResult()\r\n at System.Net.Http.WinHttpHandler.d__105.MoveNext()"

调用函数我删除了一些与http-client无关的逻辑代码:

private async Task _call(String body)

{

var client = new HttpClient();

client.DefaultRequestHeaders.Clear();

client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("text/xml"));

client.DefaultRequestHeaders.Add("SoapAction", action + "/" + service);

client.Timeout = TimeSpan.FromMinutes(3);

StringContent httpContent = new StringContent(xml, Encoding.UTF8, "text/xml");

HttpResponseMessage resp = await client.PostAsync(url + "/" + wSAP, httpContent);

return await resp.Content.ReadAsStringAsync();

}

电话是:

var resp = _call(body);

return resp.Result;

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值