182

In my Win 7 development machine, and in order to use SQL Express instance instead of the localDB installed by default. I unchecked "Use IIS Express" in my MVC 4 project properties page (Web tab), then I got the following error:

ASP.NET 4.5 has not been registered on the Web server. You need to manually configure your Web server for ASP.NET 4.5 in order for your site to run correctly.

I verified that ASP.NET is activated within the IIS features.

Please what could be done to resolve this?

Sami-L
  • 5,553
  • 18
  • 59
  • 87
  • Just for others coming here: You also have to adjust your web.config file by adding the `targetFramework="4.5"` attribute to the `` element. – Uwe Keim May 27 '13 at 08:19

19 Answers19

216

Maybe you have to execute the following in the Visual Studio Tools command prompt:

aspnet_regiis -i

You can read more about the ASP.NET IIS Registration Tool (Aspnet_regiis.exe) here.

Alex Filipovici
  • 31,789
  • 6
  • 54
  • 78
  • 2
    aspnet_regiis -i is not recognized as internal command, this is the returned error message. – Sami-L Dec 06 '12 at 17:42
  • Till now could not run it, I have in my programs and features Microsoft .Net Framework 4 Multi-Targeting pack, Microsoft .Net Framework 4.5, Microsoft .Net Framework 4.5 Multi-Targeting pack, Microsoft .Net Framework 4.5 SDK, but could not install on my Windows 7 x64 neither Microsoft .Net Framework 2.0 nor Microsoft .Net Framework 3.5, when I try to install Microsoft .Net Framework 4 I receive a message that the Microsoft .Net Framework 4.0 client is already installed on my machine – Sami-L Dec 06 '12 at 19:09
  • Try to search your computer for all the files named `aspnet_regiis.exe`. – Alex Filipovici Dec 06 '12 at 19:14
  • I have aspnet_regiis.exe v 2.0 and aspnet_regiis.exe v 4.0 both x86 and x64 – Sami-L Dec 06 '12 at 20:37
  • 33
    I could finaly resolved the issue, I have run Visual studio developper command prompt as Administrator then launched C:\Windows\Microsoft.NET\Framework64\v4.0.30319>aspnet_regiis -i – Sami-L Dec 06 '12 at 20:51
  • 28
    @Sami-L Important note: There's no actual need to use the VS cmd (which you probably don't have when you are installing a new OS). All you need is a command line (cmd) and run `aspnet_regiis` from the latest .Net framework library: `C:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet_regiis.exe /i` – i3arnon Jul 25 '14 at 12:34
  • 1
    can't run it on windows 8.1 – Hamed Zakery Miab Dec 22 '14 at 04:52
  • 2
    Today (2015) the issue is likely the bug mentioned in this answer: https://stackoverflow.com/a/30352820/1121033 – Göran Roseen Nov 16 '15 at 16:34
  • 24
    For Visual Studio 2012 you actually need to download an update to fix it from here: https://support.microsoft.com/en-us/kb/3002339 – Sameer Alibhai Nov 16 '15 at 21:17
  • 1
    @SameerAlibhai your update suggestion worked for me, the other suggestions did not. – johnnyRose May 25 '16 at 19:41
  • I had VS 2017 show me this message: `ASP.NET 4.6 has not been registered on the Web server. You need to manually configure your Web server for ASP.NET 4.6 in order for your site to run correctly.` This command solved my issue. – JwJosefy Sep 27 '17 at 22:52
107

On Windows 8.1, since .NET 4.5 is built-in, the fix is to run this from an administrative command-prompt:

dism.exe /Online /Enable-Feature /all /FeatureName:IIS-ASPNET45
NYCdotNet
  • 4,500
  • 1
  • 25
  • 27
  • 1
    Is `/all` necessary? Here: http://support.microsoft.com/kb/2736284 they do not specify it... – CITBL Oct 03 '13 at 09:25
  • 5
    According to the dism command-line on Windows 8.1, /all automatically enables parent features. In this case, it specifically mentions NetFx4Extended-ASPNET45 and IIS-NetFxExtensibility45 if you don't specify /all. – NYCdotNet Oct 04 '13 at 03:08
  • 1
    It shows error:87 and gives a message that this feature is unknown. What to do? – Sooraj Sep 07 '14 at 09:15
  • Fixed the issue on Windows 2012 with IIS8 – Jason Massey Nov 30 '15 at 20:11
68

If you've installed .NET framework 4.6, you may see this error due to a VS bug. Workarounds and resolutions here:

http://blogs.msdn.com/b/webdev/archive/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.aspx

EDIT:

As noted in some of the comments, this can happen behind the scenes after upgrading to Windows 10 or Visual Studio 2015.

lasseschou
  • 1,550
  • 15
  • 24
  • 3
    Finally found the answer! This happen when I upgrade to Windows 10. Thanks – Michael Aguilar Aug 11 '15 at 15:51
  • 2
    It happened to me when i added VS 2015 to my computer while i still have 2012 – SubqueryCrunch Sep 14 '15 at 13:44
  • This fixed on Windows 10 with .NET 4.6 and VS 2012 – Steven Jan 28 '16 at 00:22
  • 2
    This was the cause of my problem. Note though that update 4 is no longer the latest update. – Peter Morris Mar 23 '16 at 10:02
  • 2
    Thank you so much. You saved my day. I had not installed .Net framework 4.6 explicitly. What I did was that I installed Visual Studio 2015 which resulted in implicit installation of .Net framework 4.6. After installation of VS 2015 I opened an existing solution in VS 2013 ( the solution was created in VS 2013 only) which started giving this asp.net 4.5 not registered error. More interestingly the "Download Visual Studio 2013 Update 4" link on this MSDN blog page takes you to download page of update 5 of VS 2013. I installed update 5 only and it solved my issue. – RBT Apr 13 '16 at 10:35
10

For Windows 8 client computers, turn on "IIS-ASPNET45" in "Turn Windows Features On/Off" under "Internet Information Services-> World Wide Web Services -> Application Development Features -> ASP.NET 4.5".

Sooraj
  • 9,717
  • 9
  • 64
  • 99
  • That's the same as running the command: dism.exe /Online /Enable-Feature /all /FeatureName:IIS-ASPNET45 – Miros Dec 18 '14 at 11:29
9

The .net framework overwrites 4.0 folder so run this command:

Register .net framework to IIS goto
Start -> run-> cmd -> run as administrator type:

cd C:\Windows\Microsoft.NET\Framework\v4.0.30319
aspnet_regiis.exe -i
Hugo Yates
  • 2,081
  • 2
  • 26
  • 24
Ved Prakash
  • 487
  • 5
  • 9
4

Resolved it with VS update.

Follow this link (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/)

Resolution: Microsoft has published a fix for all impacted versions of Microsoft Visual Studio.

Visual Studio 2013 –

Download Visual Studio 2013 Update 4 For more information on the Visual Studio 2013 Update 4, please refer to: Visual Studio 2013 Update 4 KB Article Visual Studio 2012

An update to address this issue for Microsoft Visual Studio 2012 has been published: KB3002339 To install this update directly from the Microsoft Download Center, here Visual Studio 2010 SP1

An update to address this issue for Microsoft Visual Studio 2010 SP1 has been published: KB3002340 This update is available from Windows Update To install this update directly from the Microsoft Download Center, here

Rahul Sonone
  • 2,685
  • 1
  • 27
  • 38
  • 1
    Similarly, Microsoft Visual Studio 2013 Update 5 also resolved this issue for me https://www.microsoft.com/en-us/download/details.aspx?id=48129 – Darren Alfonso Sep 21 '16 at 18:31
  • +1 for including a reference link *and* including the snippet of text that includes the actual fix (so the answer survives the test of time once the url link goes stale). – Jeff Mergler May 24 '22 at 16:23
4

tl;dr; Clicking OK is the workaround, everything will work fine after that.

I also received this error message.

Configuring Web http://localhost:xxxxx/ for ASP.NET 4.5 failed. You must manually configure this site for ASP.NET 4.5 in order for the site to run correctly. ASP.NET 4.0 has not been registered on the Web server. You need to manually configure your Web server for ASP.NET 4.0 in order for your site to run correctly.

Environment: Windows 10, IIS8, VS 2012 Web.

After finding this page, along with several seemingly invasive solutions, I read through the hotfix option at https://support.microsoft.com/en-us/help/3002339/unexpected-dialog-box-appears-when-you-open-projects-in-visual-studio as suggested here.

Please avoid doing anything too drastic, and note the section of that page marked "Workaround" as shown below:

Workaround


To work around this issue, click OK when the dialog box appears after you either create a new project or open an existing Web Site Project or Windows Azure project. After you do this, the project works as expected.

In other words, click OK on the dialog box one time, and the message is gone forever. The project will work just fine.

Travis J
  • 81,153
  • 41
  • 202
  • 273
3

Not required to type c:\

Start -> run-> cmd -> Run as administrator and execute below command


.NET Framework version 4 (32-bit systems)

%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe -i

.NET Framework version 4 (64-bit systems)

%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_regiis.exe -i

Alternatively use Command Prompt from Visual Studio tools: C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Microsoft Visual Studio 2012\Visual Studio Tools>VS2012 x86 Native Tools Command Prompt

Version could vary.. Hope this helps.

Bharath T
  • 41
  • 1
  • 7
dipan chikani
  • 199
  • 4
  • 13
2

I had the exact same problem, despite ASP.NET 4.5 appearing as installed under "Turn Windows Features On/Off". I tried everything until I finally removed ASP.NET 3.5 and 4.5 completely from under "Turn Windows Features On/Off", rebooted my PC and reinstalled them Again. That solved the problem.

Miros
  • 527
  • 1
  • 3
  • 11
  • And now the problem is back, even nagging me about ASP.NET 4.0 now... Does anybody know if this is a bug in VS2013? – Miros Jan 13 '15 at 08:10
2

I was also having that problem. I tried the above solutions but didn't work for me.

The i installed the visual studio update and my issue was fixed.

Download the visual studio update from the link below http://blogs.msdn.com/b/webdev/archive/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.aspx

Thanks!

2

For windows 10 with below error: Configuring Web http://localhost:64886/ for ASP.NET 4.5 failed. You must manually configure this site for ASP.NET 4.5 in order for the site to run correctly. ASP.NET 4.0 has not been registered on the Web server. You need to manually configure your Web server for ASP.NET 4.0 in order for your site to run correctly. Solution: 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/

Bharath T
  • 41
  • 1
  • 7
2

Something you need to add via the Programs & Features. Check out the link below that solved my issue. Just follow the steps below and you should get it.

Quoted from the link:

Once in the Programs and Features window, hit the "Turn Windows Features on or off" in the left pane.

Now scroll down through the tree and find:

Internet Information Services > World Wide Web Services > Application Development Features ...and then check all the relevant features you require. I chose .NET 3.5 and 4.6.

http://modelrail.otenko.com/electronics/asp-net-4-5-has-not-been-registered-on-the-web-server

TPG
  • 2,811
  • 1
  • 31
  • 52
1

I have the same problem.

And got the solution turning on the ASP Net from Turn Windows feature on or off menu.

Ethaan
  • 11,291
  • 5
  • 35
  • 45
1

this link explains what cause the problem and the quick solve to the problem, it just by updating visual studio and it provide the link for the update

http://blogs.msdn.com/b/webdev/archive/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.aspx

David Fawzy
  • 1,056
  • 15
  • 17
John Mathew
  • 41
  • 12
  • This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post. – Bruce Sep 15 '15 at 04:38
1

I have the same issue when using Visual Studio 2012. By turn on the IIS feature just not working, because I still received the error. Try the method but no lucky.

My solution is:

  • Download the hotfix.
  • At the command line, Restart IIS by typing iisreset /noforce YourComputerName, and press ENTER.
Community
  • 1
  • 1
1

Some IIS features to be enabled: Reference

DISM /Online /FeatureName:IIS-ApplicationDevelopment 
/FeatureName:IIS-ASPNET /FeatureName:IIS-ASP 
/FeatureName:IIS-NetFxExtensibility 
/FeatureName:IIS-ISAPIExtensions /FeatureName:IIS-ISAPIFilter

Then fix IIS mappings for ASP.NET, run the Aspnet_regiis.exe utility. Reference

MarwaAhmad
  • 808
  • 9
  • 21
1

Try this Once go to the Programs and Features window->, hit the "Turn Windows Features on or off" in the left pane.

Now scroll down through the tree and find:

Internet Information Services World Wide Web Services Application Development Features ...and then check all the relevant features you require. I chose .NET 3.5 and 4.6.

and if does not work then go to Let it do its work and then you should be back to happy-development-land in VS before you know it. If not, then it could actually be a bug in Visual Studio. Please check the following patches for your version of VS: VS2010, VS2012 or VS2013. This will surely help you out.

Hema Shetty
  • 109
  • 1
  • 4
1

run visual studio in admin rights and execute following "commandaspnet_regiis -i"

Mandar
  • 480
  • 4
  • 5
0

I had the same problem. After a long search , I change the application pool to ASP.NET v4.x in the IIS manager.

vaheeds
  • 2,594
  • 4
  • 26
  • 36