هذه المقالة متوفرة أيضا باللغة العربية، اقرأها هنا.
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.
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.)
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.NETFrameworkv<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:
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.)
Enjoy your day!