“net:: ERR_INVALID_HTTP_RESPONSE” in Net Core 2.2 WebAPI invocation within Chrome browser or noticeable when if invoked with Angular Http services.
You are watching: Err_invalid_http_response
This error is also noticeable when .NET Core 2.2 WebAPI is invoked within UI framework like Angular (5,6 or 8) or Vue or React.js using Chrome browser.
Also API returns proper HTTP Status code and response using SOAP UI or Postman apps show proper 200 OK response but the browser shows the above error.
This issue is reproducible with below version of .NET Core SDK
.NET Core SDK version with Issue,
.NET Core version with the resolution,
2.2.105 and above is recommended.
So if you want to fix the issue, please use version 2.2.105 and above.
I have personally verified version 2.2.105 on my machine and found to be working fine. The issue might not be reproducible for other versions of the .NET Core SDK like 103 or 104, I could not verify that but surely please check and confirm from your side.
But please check and confirm if this option is feasible for your project.
The above error will go away if downgraded to .NET Core 2.1 version.
There are other workarounds as well for the given issue which is explained below,
Open Startup.cs file of target WebAPI application and update the Configure() method as below. This simple middleware component in API pipeline helps to resolve the issue.
Did the above steps resolve your issue? Please sound off in the comments below!
Please bookmark this page and share this article with your friends and Subscribe to the blog to get a notification on freshly published best practices of software development.