3

Aim:

Locally run ASP.NET MVC website on IIS express on any browser.

History:

The project in concern is an ASP.NET MVC website which initially was setup to use Local IIS with SSL enabled. I tried to set it up on IIS express:

website configuration

RouteConfig.cs file

    public static void RegisterRoutes(RouteCollection routes)
    {
        routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

        routes.MapRoute(
            name: "Default",
            url: "{controller}/{action}/{id}",
            defaults: new { controller = "Home", action = "_View", id = UrlParameter.Optional }
        );
    }

There are 2 redirection possibilities in web.config

For authentication

<authentication mode="Forms">
  <forms loginUrl="~/Account/Login" timeout="2880" />
</authentication>

For error handling

<customErrors mode="RemoteOnly" defaultRedirect="~/Views/Error/Error.html" redirectMode="ResponseRewrite">

Problem:

Although the above setting is done, the site is getting redirected to Local IIS (https://localhost) instead of IIS express (e.g. http://localhost/12345 or https://localhost/12345).

What is tried so far:

There is a question mark on the site which inside IIS, this must be ignorable

multiple procols

After removing https binding, the redirection is happening however the page seems to be not loading.

https removed

Visual studio is allowing to debug the Application_Start() and Configuration(IAppBuilder app). Afterwards, any break point is not hit.

This is happening with all controllers and actions on all browsers.

Where am I going wrong? or is it some bug?

Community
  • 1
  • 1
Zameer Ansari
  • 23,672
  • 19
  • 120
  • 191

1 Answers1

3

Not sure what is the hack behind this...

To run an ASP.NET MVC website on IIS Express (instead of Local IIS) with SSL enabled, one need to make sure that the 5 digit URL port starts with 443xx

where xx can range from 0 to 99

443xx port

Now, the redirection is also not happening. The website is perfectly running on IIS Express

Community
  • 1
  • 1
Zameer Ansari
  • 23,672
  • 19
  • 120
  • 191