This is weird coming from Microsoft. From visual studio when I execute my application code from Visual studio, most of the time I get that following error, I publish the code to my own server, the web application works fine (I don't get any error making the request) and from my pc (same pc where visual studio is) I make the same request into soapUI, I don't get any error from the server URL I'm calling. Why am I getting this error from Visual studio and I to fix this.
I can't provide the url for security reason.
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.<InvokeActionMethodAsync>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.<StartRequest>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.<SendAsync>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.<FinishSendAsyncBuffered>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}
Message: An error occurred while sending the request.
Source: "System.Private.CoreLib"
Other 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.<StartRequest>d__105.MoveNext()}
ErrorCode: -2147012744
NativeCodeError: 12152
Source: "System.Private.CoreLib"
StackTrace:
" at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n at System.Threading.Tasks.RendezvousAwaitable`1.GetResult()\r\n at System.Net.Http.WinHttpHandler.<StartRequest>d__105.MoveNext()"
The call function I remove some logical code that is not about http-client:
private async Task<String> _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();
}
the call is:
var resp = _call(body);
return resp.Result;
User contributions licensed under CC BY-SA 3.0