7
votes

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 ?

6
I would vote this as an exact duplicate of stackoverflow.com/questions/13749138/…, but I currently cannot due to the bounty. - Claies
@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 Gu

6 Answers

2
votes
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

2
votes

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
votes

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

0
votes

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).

0
votes

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.

0
votes

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