[asp.net-mvc-4] Register .NET Framework 4.5 in IIS 7.5

Pieces of the puzzle:

  • Windows 7
  • .NET Framework 4.5 (installed)
  • IIS 7(Version 7.5.7600.16385)
  • Visual Studio (Ultimate 2013)
  • MVC4 (multiple projects in the solution)

The solution I'm running in Visual Studio works and runs as expected with IISExpress.

To set up my site to use IIS, I tried the following steps:

  1. Right-click the projects in the solution that are currently being hosted by IISExpress.
  2. Click Properties.
  3. Toggle the Servers drop-down from IISExpress to Local IIS
  4. Try to build/run the application

At this point, I get an HTTP 500.21 error.

I have also tried to run aspnet_regiis.exe -i using Visual Studio's command prompt (as an Administrator), but each time I run the command, I receive the following error:

Command 'aspnet_regiis.exe' is not valid.

I also confirmed that I do have the right aspnet_regiis.exe installed (by checking here) (.NET Framework version 4 (64-bit systems)).

What do I need to do to register .NET Framework 4.5 in IIS 7.5?

The answer is


use .NET3.5 it worked for me for similar issue.


I got into this mess twice and after searching long and hard and following what others did absolutely nothing worked for me but to uninstall and install IIS back once on Windows 7 machine and then on Windows server 2012 R2.


Hosting asp.net 4.5/4.5.1 Web application on Local IIS 1)Be Sure IIS Installation before Visual Installation Installataion then aspnet_regiis will already registerd with IIS

If Not Install IIS and then Register aspnet_regiis with IIS by cmd Editor

For VS2012 and 32 bit OS Run Below code on command editor :

1)Install IIS First & then

2)

cd C:\Windows\Microsoft.NET\Framework\v4.0.30319   

  C:\Windows\Microsoft.NET\Framework\v4.0.30319> aspnet_regiis -i

For VS2012 and 64 bit OS Below code on command editor:

1)Install IIS First & then

2)

cd C:\Windows\Microsoft.NET\Framework64\v4.0.30319    
  C:\Windows\Microsoft.NET\Framework64\v4.0.30319> aspnet_regiis -i

BY Following Above Steps Current Version of VS2012 registered with IIS Hosting (VS2012 Web APP)

Create VS2012 Web Application(WebForm/MVC) then Build Application Right Click On WebApplication(WebForm/MVC) go to 'Properties' Click On 'Web' Tab on then 'Use Local IIS Web Server' Then Uncheck 'Use IIS Express' (If Visul Studio 2013 Select 'Local IIS' from Dropdown) Provide Project Url like "http://localhost/MvcDemoApp" Then Click On 'Create Virtual Directory' Button Then Open IIS by Prssing 'Window + R' Run Command and type 'inetmgr' and 'Enter' (or 'OK' Button) Then Expand 'Sites->Default Web Site' you Hosted Successfully. If Still Gets any Server Error like 'The resource cannot be found.' Then Include following code in web.config

 <configuration>
     <system.webServer>
         <modules runAllManagedModulesForAllRequests="true"></modules>

And Run Application

If still problem occurs Check application pool by : In iis Right click on application->Manage Application->Advanced setting->General. you see the application pool. then close advance setting window. click on 'Application Pools' you will see the all application pools in middle window. Right click on application pool in which application hosted(DefaultAppPool). click 'Basic Setting' -> Change .Net FrameWork Version to->.Net FrameWork v4.0.30349


For Windows 8 and Windows Server 2012 use dism /online /enable-feature /featurename:IIS-ASPNET45 As administrative command prompt.


Examples related to asp.net-mvc-4

Better solution without exluding fields from Binding How to remove error about glyphicons-halflings-regular.woff2 not found When should I use Async Controllers in ASP.NET MVC? How to call controller from the button click in asp.net MVC 4 How to get DropDownList SelectedValue in Controller in MVC Return HTML from ASP.NET Web API There is no ViewData item of type 'IEnumerable<SelectListItem>' that has the key country Return JsonResult from web api without its properties how to set radio button checked in edit mode in MVC razor view How to call MVC Action using Jquery AJAX and then submit form in MVC?

Examples related to visual-studio-2013

Microsoft Advertising SDK doesn't deliverer ads Visual Studio 2013 error MS8020 Build tools v140 cannot be found Visual Studio 2013 Install Fails: Program Compatibility Mode is on (Windows 10) 'cannot find or open the pdb file' Visual Studio C++ 2013 Force uninstall of Visual Studio How to enable C# 6.0 feature in Visual Studio 2013? Failure [INSTALL_FAILED_UPDATE_INCOMPATIBLE] even if app appears to not be installed Process with an ID #### is not running in visual studio professional 2013 update 3 Error C1083: Cannot open include file: 'stdafx.h' The OLE DB provider "Microsoft.ACE.OLEDB.12.0" for linked server "(null)"

Examples related to iis-7.5

The client and server cannot communicate, because they do not possess a common algorithm - ASP.NET C# IIS TLS 1.0 / 1.1 / 1.2 - Win32Exception Register .NET Framework 4.5 in IIS 7.5 HTTP Error 401.2 - Unauthorized You are not authorized to view this page due to invalid authentication headers IIS error, Unable to start debugging on the webserver How do I get to IIS Manager? How prevent CPU usage 100% because of worker process in iis How do I give ASP.NET permission to write to a folder in Windows 7? ASP.NET 4.5 has not been registered on the Web server Fixing slow initial load for IIS "Cannot verify access to path (C:\inetpub\wwwroot)", when adding a virtual directory

Examples related to windows-7-x64

"The following SDK components were not installed: sys-img-x86-addon-google_apis-google-22 and addon-google_apis-google-22" The service cannot accept control messages at this time Creating self signed certificate for domain and subdomains - NET::ERR_CERT_COMMON_NAME_INVALID ImportError: No module named enum Git credential helper - update password Can't connect to MySQL server on '127.0.0.1' (10061) (2003) Register .NET Framework 4.5 in IIS 7.5 Windows 7 - Add Path How do I start Mongo DB from Windows? How to completely remove node.js from Windows

Examples related to asp.net-4.5

Register .NET Framework 4.5 in IIS 7.5 GlobalConfiguration.Configure() not present after Web API 2 and .NET 4.5.1 migration IIS_IUSRS and IUSR permissions in IIS8