Asp.net-mvc – Setting up virtual directory when using IIS for ASP.NET MVC debugging

asp.net-mvc

I am trying to use IIS for debugging ASP.NET MVC in Visual Studio. The problem is that if I choose "Use Local IIS Web server" in Visual Studio, I have to choose a virtual directory, something like http://localhost/myapp/

This is a problem because the ASP.NET MVC application is assumed to run from the root directory and the MVC would parse "myapp" as a controller, and when I run the app from Visual Studio/IIS, subsequent requests will be directed to the root anyway.

How to solve this problem? Is there a way to use the IIS website root instead of a virtual directory for Visual Studio debugging?

Best Answer

Yes you can run an ASP.NET MVC as the root application.

Just use IIS manager to set the home directory for the website to the your application's path.

Then make the appropriate changes in the "Web" tab of your project settings for MVC in Visual Studio.

This is assuming you have windows file permission setup correctly for IIS already.

Related Topic