Epic Blog of Awesome

code.tech.sci.math.art.write

Using Visual Studio database projects in real life – Gunnar Peipman’s ASP.NET blog

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.

via Using Visual Studio database projects in real life – Gunnar Peipman's ASP.NET blog.

Code clarity: Tips on using Virtual Directories in ASP.NET, MVC, HttpSimulator, SiteMap

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.

via Code clarity: Tips on using Virtual Directories in ASP.NET, MVC, HttpSimulator, SiteMap.

Experience ASP.NET MVC 3 Beta – the Razor View Engine


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.

via Experience ASP.NET MVC 3 Beta – the Razor View Engine.

ASP.NET MVC View Model Patterns

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.

via ASP.NET MVC View Model Patterns.

>HTTP Error 500.19 – Internal Server Error + IIS 7.5 | Andrew Murphy’s E-Memory

>

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.

Problem

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:

error

config

Error message:

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:

1: <configSections>

2:   <sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">

3:     <sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">

4:       <section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>

5:       <sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">

6:         <section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere"/>

7:         <section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>

8:         <section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>

9:         <section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>

10:       </sectionGroup>

11:     </sectionGroup>

12:   </sectionGroup>

13: </configSections>

This is strange because:

  1. The site runs fine in Visual Studio 2010.
  2. It works when deployed into IIS via Visual Studio 2008 (on a different development machine and in live).
  3. This site works if you alter the framework target to be .net 4.0 and then deploy to IIS and run as normal.

History

This web site was originally developed in Visual Studio 2008 but desperate to try 2010, I followed the procedure below:

  1. Installed 2010 on a clean machine (nothing in IIS).
  2. Converted the 2008 solution but kept the framework target as 3.5.
  3. Ran from Visual Studio.
  4. Deployed to IIS and attempted to run from there.

Fault Finding

My first thoughts were:

  1. 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.
  2. 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:

handlerMappings

Solution

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:

applicationPools

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.

Posted via email from Mocha Brain Freeze