Behavior / Steps to reproduce
Running ASP.NET Core application on Kestrel Web Server. Every time the app is run, it makes a strange redirect to “https”, and the call doesn’t work. In console you see the following error.
Notice : This error doesn’t occur while running on IIS Express.
Explanation
This happens if in your startup file you have services configured with filters to have only Https attributes
This will require you to have local certificate. In case of IIS Express, IIS Express takes care of it for you. However, for other web server such as Kestrel this doesn’t work.
How to fix this
If you are just testing locally, you can simply comment this filter out, and everything will work. However, if you have to use the SSL, you should create a certificate and use it in your code. How to create Certificate is explained in this awesome post. To use it in your app, you need to call this certificate in your app, and configure this certificate in your WebHostBuilder as shown in this Answer.
Posted
May 09 2017, 05:51 PM
by
Indraneel Pole