Thursday, December 1, 2011

Learning MVC: Installing Application on IIS.

Today I tried installing the MVC application on IIS 7.

It was not an extremely complicated task, as long as understood the prerequisites. I installed the .NET Framework 4 on the server that has IIS7. I then registered the .NET Framework with IIS by running the registration tool (aspnet_regiis.exe)

Before publishing a project, it is a good idea to use the "Add Deployable Dependencies" to make sure all required libraries are added to the published application. Initially I missed this step and started getting errors like the one below.

Initially I tried to solve them by manually copying the required dlls to the bin folder of the application, but got tired quickly and found a better solution, as mentioned above.

It generated a rather long list of files, it probably would not be a good idea to copy them all manually one by one.

Next, I published the project to a file system.

Created a directory on the server that is running IIS under wwwroot/test, copied the published application to the server, created the virtual directory on the Default Web Site and pointed it to my wwwroot/test folder. That was enough to be able to start the application and see the welcome page. Unfortunately, that is not the end of it. At this point I can navigate to the "Register" page, but the App_Data folder does not yet exist and also when I try to go my InBasket page directly, I get a server error. Additionally, my local version of the application, which worked fine, now displays the same behaviour. Quite a few things to fix!

References

Bin deploy required dependencies for MVC 3 projects with Visual Studio 2010 SP1
ASP.NET MVC on IIS 6 Walkthrough
ASP.NET IIS Registration Tool (Aspnet_regiis.exe)
BIN Deploying ASP.NET MVC 3 with Razor to a Windows Server without MVC installed by . Also posted on my website

No comments: