Configuring ASP.NET with IIS

هذه المقالة متوفرة أيضا باللغة العربية، اقرأها هنا.

Problem

The problem arises when you install IIS after installing ASP.NET. If you do this, IIS will configure itself for the ASP.NET version that ships with your Windows edition that might be an older version (e.g. version 2.0) and you won’t be able to run any web application built using a later version of ASP.NET.

Solution

The solution is simply to reconfigure ASP.NET for IIS. You don’t need to reinstall ASP.NET or the .NET Framework; you just need to reapply ASP.NET configuration to the IIS.

When you open the IIS Manager, you can check Application Pools and see which version of ASP.NET is currently configured. Here, we have IIS installed after ASP.NET, so the IIS is configured for version 2.0 (as you can see in figure 1.)

Figure 1 - IIS Application Pools Configuration - .NET 2.0

Figure 1 - IIS Application Pools Configuration - .NET 2.0

To solve this, we’ll get help from the aspnet_regiis.exe tool that will reconfigure IIS to the version of ASP.NET you choose. This tool is located in %windir%\Microsoft.NET\Framework\v<version> (replace <version> with the version of .NET Framework you like to use.)

Let’s get this done. Open the Command Prompt in administrative mode (Start->Cmd->Ctrl+Shift+Enter) and go to the .NET Framework directory mentioned before.

Now, run the ASP.NET IIS Registration tool using the following command:

aspnet_regiis.exe -i

When the tool finishes its job, you’ll get a message inform you that everything was completed successfully.

Now go to IIS Manager again and check the Application Pools. You can now find that IIS is configured for ASP.NET 4.0 which is installed on that machine (see figure 2.)

Figure 2 - IIS Application Pools Configuration - .NET 4.0

Figure 2 - IIS Application Pools Configuration - .NET 4.0

Enjoy your day!

Similar Posts:

Random Posts:

Recent Posts:

  • Michael Schaumburg (Denmark)

    Nice and clear explanation, thanks :-)