- Page not found error.
- Only the first page opens after setting URL routing.
Here are some of the solutions I found helpful. I have used them. Hopefully they work for you :)..
I have given the detailed instructions for everyone to understand.
Basic IIS setup
- Install the IIS
- Install .Net framework 3.5 SP1 (Install after IIS is installed because permissions are not set properly if these steps are interchanged)
- If IIS is installed after .Net, try resetting the Framework by
- C:/Windows/Microsoft .Net/Framework/V2.0xxx/aspnet_regiis –i
- Install the application or copy paste (depends on how you want to deploy)
- Configure the IIS as follows
- Add the Application to the server under the default websiteRight-Click->Properties.
- Under the virtual directory select Configuration
- Under Mappings select Add
- Give the path of asp api in Executable i.e “C:/Windows/Microsoft .Net/Framework/V2.0xxx/aspnet_isapi.dll”
- Give the extension as “.*”
- Uncheck the “Check that file exists”
- If Ok button is disabled click on the text box of Executable.
- Make changes in the application as needed so that URLs are relative to Hosting Environment(Refer below on how to modify MVC URLs for deployment).
- Also you have to change the DataBase folder i.e. App_Data`s permission to R/W else “Cannot write to database” error occurs.
The above steps ensure that your Asp.NET MVC app runs, i.e. first problem is solved.
How to modify MVC URLs for deployment
- Usually when we write a Asp.Net MVC app, we give the URLs as "/Home/abcd" but this wont work as "/" is not the root of project but it is the root of the application in the website deployed.
- To solve this problem we have a URL provider for Asp.NET MVC. It takes the Controller, Action as parameters and returns a URL for navigation
This will solve the second problem :)