Reputation: 836
I'm building a simple website in vs2015. I have IIS express selected as the hosting environment. I have tried multiple new projects and seem to be going around in circles, having installed and uninstalled iis-express 10 multiple times, and added and removed windows feature of iis also. When I launch a web project from vs2015, it used to open (without issue) a http://localhost:port (e.g. http://localhost:51898), but now continually redirects to https://localhost.
Any idea why?
Upvotes: 8
Views: 25007
Reputation: 117
in my case, it was a configuration i did on IIS for all my sites to load via https. The rewrite rule matched localhost as well and hence it redirects to https. I rewrote the redirect rule and it was ok.
Upvotes: 0
Reputation: 1520
In my situation it was caused by this piece of code:
services.Configure<MvcOptions>(options =>
{
options.Filters.Add(new RequireHttpsAttribute());
});
Anyway double check you startup.cs file. Maybe configurations there are part of a problem
Upvotes: 3
Reputation: 41
It is not about Visual Studio, it is about Chrome. This solution worked for me: Google Chrome redirecting localhost to https
Upvotes: 3
Reputation: 5677
the redirect will only happen with explict configuration and IIS or asp.net will not automatically redirect .
e.g. <httpRedirect enabled="true" destination="https://localhost" />
check for urlrewrite configurations. a typical rule will be like this .so you can search for Redirect
<action type="Redirect" url="http://www.maindomain.com/{R:1}" />
</rule>
Upvotes: 2