Visual Studio database projects are good to support software development. I have successfully used database projects for years and I think it’s time to share my experiences also to global developers audience. In this posting I will introduce you how to effectively use database projects so developers are working with up-to-date schema and test data all the time.
Tips on using Virtual Directories in ASP.NET, MVC, HttpSimulator, SiteMap
Imagine you develop a web-site. You register IIS site to test it, seems like all is ok. You deploy it to customer, and… oh no! where is my images, styles, scripts? and why site map causes an exception?!
It is common situation when site developed and tested on IIS web-site root, and deployed into Virtual Directory. Here I want to describe some tips to avoid such situations.
Creating AJAX based CRUD tables using ASP.NET MVC 3 and the jTable jQuery plug-in.
Razor is designed to be an alternate view engine for ASP.NET MVC. Initially introduced in WebMatrix and now shipped as part of ASP.NET MVC 3 Beta, Razor allows developers to replace the clunky <% %> syntax with a much cleaner coding model mainly around the sign @. Moreover, it provides some excellent features for Master Page scenarios, while at the same time you won’t lose access to any features you are already familiar with, such as HTML helper methods.
Since MVC has been released I have observed much confusion about how best to construct view models. Sometimes this confusion is not without good reason since there does not seem to be a ton of information out there on best practice recommendations. Additionally, there is not a “one size fits all” solution that acts as the silver bullet. In this post, I’ll describe a few of the main patterns that have emerged and the pros/cons of each. It is important to note that many of these patterns have emerged from people solving real-world issues.
ASP.NET 2.0 application using Infragistics web controls v6.1. Other apps use 7.1. Both 6.1 dll’s and 7.1 dll’s are in the GAC. When I execute the application I get this error:
To fix it, I added some
This way the compiler knows to use the 6.1 version and not the 7.1 versions.
My app stopped posting changes to data. The Save method in my controller wasn’t even hit on a JQuery post. What I discovered is that I can’t have two “Save” methods in the same controller, even when they have different signatures. Renamed one of them and all is good.
This is the error that faced me the first time I deployed a .net Framework 3.5 web site to IIS via Visual Studio 2010 and then tried to run it. After a couple of hours of digging I traced it back to the application pool but I thought it worthy of a write-up.
Attempting to run a .net framework 3.5 web site hosted in IIS 7.5 (deployed via Visual Studio 2010) gives the following error information:
There is a duplicate ’system.web.extensions/scripting/scriptResourceHandler’ section defined
The error points to sections in the web.config file that ships with the site, a clearer view of which is here:
This is strange because:
- The site runs fine in Visual Studio 2010.
- It works when deployed into IIS via Visual Studio 2008 (on a different development machine and in live).
- This site works if you alter the framework target to be .net 4.0 and then deploy to IIS and run as normal.
This web site was originally developed in Visual Studio 2008 but desperate to try 2010, I followed the procedure below:
- Installed 2010 on a clean machine (nothing in IIS).
- Converted the 2008 solution but kept the framework target as 3.5.
- Ran from Visual Studio.
- Deployed to IIS and attempted to run from there.
My first thoughts were:
- That IIS thinks this is a .net Framework 4 site rather than a 3.5. I find this hard to check as aspnet_regiis –lk does not work on Windows 7 (my development OS) and finding anything in IIS 7 is a pain in the neck.
- Visual Studio 2010 has messed something up.
Confirming the versions of the target assemblies for the site was problematic however. When the site was built as .net 4 and so worked, I was able to view the Handler Mappings for the site. When it was built for .net 3.5 and so broke, I couldn’t view the mappings as IIS displayed the same error as at run-time:
It turned out that IIS was confused about the .net framework to use after all, or at least about the application pool version to use.
Viewing the application pools in IIS showed that I had the following:
As you can see, my application was sitting with the default web site inside the DefaultAppPool, which is configured to target .net 4. Moving the site into the Classic.NET AppPool fixed the issue and worked a treat.
It would have been nice for this to have worked out of the box but you live and learn.
This entry was posted on Tuesday, April 20th, 2010 at 19:02 and is filed under .Net Framework, ASP.Net, Errors, IIS, Misc. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.