Solution to MVC app listing contents of directory instead of executing routes

I just deployed a new MVC web app and instead of executing the routes it just listed the contents of the directory like so:

There could be many reasons for this, but I figured out the reason it was happening for me was that my AppPool was set to Classic instead of Integrated.

Change your mode to Integrated and it should work.