Friday, November 11, 2011

Working on an ASP.NET Project

Last week I started working on an ASP.NET project.  At the start, I was planning to use ASP.NET MVC 3.  I worked on MVC project 5 years ago.  That project was based on initial framework by Microsoft Patterns and Design group. Now this MVC has been changed a lots. It seems much easier to work with.

The first thing was a spike on this new framework. I tried one example from ASP.NET MVC web page.  One thing I don't like is that the project is integrated with Microsoft Entity Framework and SQL Express.  I had to break the connection to the SQL db to make it work. It took me one day to get main web page working.

Then I deployed to  our dev IIS, which is in a box of Windows Server 2008 R2 with .NET 2.0, 3.5 available. Unfortunately, the initial deployment was not working.  The project I created was based on MVC 4 and .NET framework 4.0.

I installed .NET framework 4.0. Still the web page on IIS was not working. I installed ASP.NET MVC package on the box. Still not working.  It looks like the Razor engine was not configured on IIS. I got 404 error, denying access to the content of a path, which is the basic structure of {site}/{controller}/{action}/, with no .aspx. Finally, I got it working by installing WebMatrix.

With all those installation, my MVC example web page was displayed on the IIS. I was very happy to tell my project BA, who is the main force to push this project with new framework. Unfortunately, on the second day, I realized that all the existing web pages stopped working. That's really bad news.

Since my project is in a very tight schedule, I made decision to roll my project back to a .NET 2.0 based ASP.NET web project. This is the one consistent with our existing web pages. I blamed Microsoft for IIS not being able to support .NET 2.0 and plus web pages.

Two days later, I spent several hours on IIS configuration. I saw that all the web sites on the deb box was based on application pool by defaults, which is .NET 4.0.  In the screen of application pool, there are previous ones based on .NET. After I changed the AP for existing web sites to .NET 2.0, all those sites are back to work. It is the updates that causes the AP changed. Still I think the installation should not change those AP settings.

That's quite up and down experience. I have learned good lesson about IIS configurations. IIS does support parallel .NET frameworks by specifying AP. Just imaging IIS as an application, and all the web sites are web pages based on all libraries.  The IIS is a complicated application. With IIS management console, the configuration can be set for web sites, which supports previous ASP.NET projects.

I'll continue to work on this project based on .NET framework 2.0 and ASP.NET. The next phase is to update it to .NET 4.0, hopefully with MVC 3.