7

I have a Windows Server 2012 R2 & Visual Studio Professional 2012. now i use to develop an asp.net 4.5 mvc 4 web application without any problem. but now when i try to open the project i will get this error:-

enter image description here

if i click OK then this error:-

enter image description here

if i click OK the visual studio will stop working

enter image description here

so can anyone adivce what is going on ??

and here is how the Turn windows features on/off looks like:- enter image description here

Now i did this modification, as i read on a post in the internet that deleting the cache might help. so i removed this folder:-

%LocalAppData%\Microsoft\VisualStudio\11.0\ComponentModelCache

then i tried to open the Visual Studio, and i got the same 2 errors, but the visual studio did not stop working, and i was able to modify the code i rebuild the project and run it.. so not sure what is going on ?

John John
  • 1
  • 72
  • 238
  • 501
  • 2
    I would vote this as an exact duplicate of https://stackoverflow.com/questions/13749138/asp-net-4-5-has-not-been-registered-on-the-web-server, but I currently cannot due to the bounty. – Claies Jul 23 '17 at 16:07
  • @Claies now running `aspnet_regiis -i` will not work in my case as i will get this message :- `This option is not supported on this version of the operating system. Administr ators should instead install/uninstall ASP.NET 4.5 with IIS8 using the "Turn Win dows Features On/Off" dialog, the Server Manager management tool, or the dism.e xe command line tool. For more details please see http://go.microsoft.com/fwlin k/?LinkID=216771. Finished installing ASP.NET (4.0.30319.0).` so i think my question is not a duplicate – John John Jul 24 '17 at 00:46
  • maybe this? https://blogs.msdn.microsoft.com/webdev/2014/11/11/dialog-box-may-be-displayed-to-users-when-opening-projects-in-microsoft-visual-studio-after-installation-of-microsoft-net-framework-4-6/ – Claies Jul 24 '17 at 01:57
  • https://stackoverflow.com/questions/5836228/asp-net-4-0-has-not-been-registered refer to this answer please – muhammad hasnain Jul 27 '17 at 12:23

6 Answers6

2
aspnet_regiis -i

Using the ASP.NET IIS Registration tool, you can perform tasks such as the following:
Register or remove the .NET Framework ASP.NET installation with IIS.
Create new ASP.NET application pools.
Display the status of all installed versions of ASP.NET.
More here

Edit 1:-

dism /online /enable-feature /featurename:IIS-ASPNET45 /all

Try running this command

Edit 2:-

Try downloading and installing this update

This is a related tweet

If you get KB3002339 hanging kill the VSUpdate process in task manager. Windows Update will finish. Bing/Google KB3002339 install manually. https://twitter.com/blowdart/status/542542342075346945

Parv Sharma
  • 12,581
  • 4
  • 48
  • 80
  • now i have windows server 2012, so if i run `aspnet_regiis -i` i will get this message :- `This option is not supported on this version of the operating system. Administr ators should instead install/uninstall ASP.NET 4.5 with IIS8 using the "Turn Win dows Features On/Off" dialog, the Server Manager management tool, or the dism.e xe command line tool. For more details please see http://go.microsoft.com/fwlin k/?LinkID=216771. Finished installing ASP.NET (4.0.30319.0). ` – John John Jul 24 '17 at 00:43
  • I have edited my ans to include the dism command. Im sry trial and error seems the only way out as reproducing this problem on my dev machine isn't possible – Parv Sharma Jul 24 '17 at 06:21
  • i do not think that .net 4.5 is not registered, as inside the server manager it is enabled.. anyways i run this command `dism /online /enable-feature /featurename:IIS-ASPNET45 /all` and it ended successfully,, but still when i try opening the project inside VS 2012 i got the same error ... – John John Jul 24 '17 at 15:43
  • also just another note which can help in solving my problem,, is that inside the same windows server 2012 r2 , i am hosting the same project inside IIS and it is working well.. but the problem will happen when i try to open the project inside visual studio.. so this gives me a indication that .net 4.5 is configured correctly inside my windows server since i am able to host the project inside IIS without any problem,, but seems the Visual studio is unable to load the .net for a reason or another as the error messages indicates... – John John Jul 24 '17 at 15:46
  • 1
    are you using iis-express? – Parv Sharma Jul 24 '17 at 16:16
  • now Visual Studio by defualt uses IIS-Express.. and i am hosting the same applications inside IIS-8 which comes with windows 2012 R2 so it is non-express version.. did u get my point ? i mean if i host the application inside IIS-8 which comes with windows 2012 i can access the hosted application without any problem... but if i run the project inside VS 2012 i will get the errors regarding .net.. now as per my knowledge VS uses iis-express when i run the project... – John John Jul 25 '17 at 12:58
  • Hi I have update the answer with a KB update like. Seems like Microsoft issued a fix for the same – Parv Sharma Jul 25 '17 at 13:11
  • now i always be very caution before start installing KBs.. now the KB is mentioning the following `This download installs a fix for failing to create ASP.NET Empty Web Application/ASP.NET Web Forms Application after installing Microsoft .NET Framework 4.5.3 ` now in my case i am using asp.net MVC web application not web forms + when i create a new asp.net mvc 4 web application i did not get the errors,, so seems the errors will only be showing when i try to open existing applications.. so i think this KB is not related to my issue... – John John Jul 25 '17 at 13:45
  • also the supported OS are `Windows 7, Windows 7 Service Pack 1, Windows Server 2003 Service Pack 2, Windows Server 2008 R2, Windows Server 2008 R2 SP1, Windows Server 2008 Service Pack 2, Windows Vista Service Pack 2, Windows XP Service Pack 3 Visual Studio 2012 .NET 4.5.3` while in my case i have windows server 2012 R2.. – John John Jul 25 '17 at 13:46
  • 1
    Can you please go to C:\Users\\Documents\IISExpress\config. and tell me the value of 'managedRuntimeVersion' of 'Clr4IntegratedAppPool' – Parv Sharma Jul 25 '17 at 15:16
  • here is the value `` – John John Jul 26 '17 at 15:40
2

In order to resolve this error you have to install related version of .Net framework in your system.

First install IIS if not installed.

Then run following command:

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

OR (Depens on your OS)

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

And in IIS your site should run on pool with version like : .Net FrameWork v4.0.xxxxxx

Open your solution as an Administrator

1

Maybe this answer comes too late, but I tried the solution from @Sameer referring to this question stackoverflow.com/questions/13749138/asp-net-4-5-has-not-been-registered-on-the-web-server#13749209

aspnet_regiis -i

didn't work for me aswell, but this update fixed the problem for VS 2012

For Visual Studio 2012 you actually need to download an update to fix it from here: support.microsoft.com/en-us/kb/3002339 – Sameer Nov 16 '15 at 21:17

D3f4u1t
  • 133
  • 1
  • 7
0

See if the computer has self updated to .NET 4.6 (due to Windows Update task). In some situations, the installation of .NET 4.6 may impact on Visual Studio 2012.

In my case I had to upgrade my project to NET 4.6 to solve the problem.

In relation to IIS itself, I guess you may be forgotten some feature - as HTTP which I guess is necessary, even if you won't utilize it directly. Check all features and toogle OFF just those really optional (like FTP).

David BS
  • 1,822
  • 1
  • 19
  • 35
0

This reminds me of similar issues I have seen in the past and I strongly suspect it's an installation order related thing which ultimately boils down to the aspnet_regiis command which has been mentioned already (here's some more information on this topic: https://rockyprogress.wordpress.com/2011/09/06/iis-7-5-and-net-framework-4-installation-order-does-matter/).

You would generally want to install IIS first and then .NET afterwards. So I suggest you get rid of the .NET 4.5 installation again by using the "Turn Windows Features On/Off" screen and then later simply add it back in.

dnickless
  • 10,733
  • 1
  • 19
  • 34
0

Please try below point

1) open Visual studio run as administration

2) Please host your site in IIS (Not on port like localhost:65389...)

3) Make sure about application pool (with framework 4.0)

4) run C:\Windows\Microsoft.NET\Framework\v4.0.30319> aspnet_regiis -i command

user2960398
  • 363
  • 4
  • 19