Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Web API throws BadHttpRequestException #1217
Yesterday I installed VS 2017 RC which quite messed up my previous environment (.NET Core was generally not working).
I have a Service Fabric application (with .NET Core Web API microservices) which ran without an issue previously but now I cannot get my REST API to work again. The request is taking really long and ends and I get this error in the debug console:
Also sometimes I get this error:
After a while I got the idea to create a new Service Fabric and later a Web API application by using the VS templates. Both result in the same error.
I have no clue what exactly is causing the error...
I'm referencing 1.0.0 and I didn't change the Kestrel or any other references since the last time it worked.
I guess it has to be an issue with my local machine somehow...
@FelschR I've run into the same error with .NET Core WebApi and Kestrel, after installing VS2017 RC yesterday.
Surprisingly, the error only occurs if I call my API via
I also tried multiple .NET Core SDK as well as .NET Core Runtime versions. But, the error still stays.
My current assumption is that something is modifying the local requests. Also played around with fiddler and saw that request for localhost are always tried with https. The strange thing is that Kestrel got the encrypted message which obviously results in "Malformed request: MethodIncomplete". All request going to
For now it's a workaround for me to just use my external ip-address instead of localhost for development and testing. But, I will investigate this as soon as I got some sparetime.
@reicheltp great (or not so much) to hear that I'm not the only one having this issue.
Meanwhile I started to completely remove VS 2015 and all .NET development tools and reinstall it from scratch. I'll update this post once it finishes installing.
Switching from localhost to 127.0.0.1 seems to work fine with Chrome.
The trick is to delete "localhost" in "chrome://net-internals/#hsts".
Maybe Kestrel could throw a better error message for HTTPS requests when HTTPS is not enabled.
#1119 provided a clearer error message ("An SSL/TLS handshake might have been attempted on an HTTP endpoint.") based on the first byte of the request being 0x16, but we decided that wasn't generic. Now our error message is more in line with what you would see from nginx.