29

How to register .Net 4.5.1 with IIS8 on windows 10 machine? it used to be simple as running command "aspnet_regiis -i"...but not anymore. if try to run this command i get error

This option is not supported on this version of the operating system. Administrators should instead install/uninstall ASP.NET 4.5 with IIS8 using the "Turn Windows Features On/Off" dialog, the Server Manager management tool, or the dism.exe command line tool. For more details please see http://go.microsoft.com/fwlink/?LinkID=216771. Finished installing ASP.NET (4.0.30319.0).

Also in windows 10 under "Turn windows feature on & off" windows why i dont see .net 4.5 or 4.5.1? i do see 4.6 though. Is it same as 4.5.1?
(note i am sure 4.5.1 is installed on my machine because visual studio allows me to set target framework 4.5.1 on web applications and i have several applications which runs on 4.5.1 without any issue)

enter image description here

LP13
  • 30,567
  • 53
  • 217
  • 400

4 Answers4

44

You can use the dism tool to enable features built into Windows. To install .NET 4.5 (or 4.6, they're the same since it's the same CLR4 underneath) into IIS, I think this will work:

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

The /all flag will include any dependencies so you don't have to figure them all out.

You can also see all of the available features by running:

dism /online /get-features

As an aside, aspnet_regiis was used when you needed to install a version of the CLR into IIS. Since all versions of .NET since 4.0 use the same CLR versions, this is now built into the Windows features. So you use DISM to enable the feature instead.

Jimmy
  • 27,142
  • 5
  • 87
  • 100
1

i do see 4.6 though. Is it same as 4.5.1?

.NET 4.6 is a drop in replacement over 4.5.1. Meaning, your 4.5.1 applications will run on 4.6. So you could say that 4.6 "includes" 4.5.1.

vcsjones
  • 138,677
  • 31
  • 291
  • 286
0

If you're ASP.NET version agnostic and just want the ASP.NET State Service running, Go to IIS -> Web Server (IIS) -> Web Server -> Application Development and choose the latest ASP.NET. This will create ASP.NET State Service in Services.msc which you can then configure to run.

abr_78
  • 33
  • 1
  • 7
0

Adding to the answers if you've end up here with a Windows Server 2022 install and you want to deploy something based on .NET 4.0 - 4.8 on IIS 10, but you're getting 500.12 http response

Windows Server 2022 should come with .NET 4.8 installed but you need a few steps to host the .NET 4+ based web applications, you need to do the following:

  1. Add Roles and Features > Server Roles > Web Server (IIS) > Web Server > Application Development > tick both ".NET Extensibility 4.8" and "ASP.NET 4.8"

  2. To the next screen, Features > .NET Framework 4.8 Features > ensure ".NET Framework 4.8" and "ASP.NET 4.8" are ticked

  3. Head over to IIS > Select your server name > Select Configuration Editor in the middle panel (should be under Management) > select "system.webServer/modules" in the section dropdown > On the right pane there should be an "Unlock Section" option that you can click to unlock it. The option in the middle panel is up to your setup, for example I've set the runAllManagedModulesForAllRequest as True

Your .NET 4 - .NET 4.8 should run as expected on IIS.

I've tried the dism option and somehow it broke my installation of the .NET frameworks, I was unsure on how to fix it and just reinstalled the OS.

fbz
  • 410
  • 5
  • 7