Help! My controller methods don’t work!

Visual Studio 2017 is a great, great piece of work but (like with all great pieces of work) sometimes the abstractions leak.

Today’s “gotcha” is the embedded IISExpress Web server.

I’m using .NET Core to host a couple of little applications. But the default route defined in the Debugger pane in Visual Studio isn’t what I want it to be.

So I went in and changed it.

However – there’s two places to set this. One is labelled “App URL”, the other “Launch browser”.

If I change the App URL — no! don’t do that. This should be the _root_ of the application as seen on the Web site. If you put something in after the slash here, IISExpress will create a second Web application entry in its configuration file and you’ll start to get odd 404 errors from your controller.

Rather, change the URL in “Launch browser”.

Now, if you mess this up: you’ll get a _second_ site in your IIS Express configuration. Finding the config file to edit is hard, as it might be in a _hidden_ .vs folder somewhere, likely not the one you’re expecting, either.

There’s notes on all this on a useful StackOverflow article here together with a neat little diagram explaining how to fix the problem.

Author: Jeremy McGee

I write software, and try to help others do the same.