What is the Windows Server 2012 command line equivalent of `aspnet_regiis -ir`?
Asked Answered
E

3

6

As documented in several questions (Alternative for the Registering ASP.NET 4.5 on Windows Server 2012; Server 2012 IIS 8 MVC app shows default IIS home page or 403 / 404 errors; WCF on IIS8; *.svc handler mapping doesn't work), on Windows Service 2012 the aspnet_regiis -ir command does not work anymore, and instead produces the following output:

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.

In our case, we only want to run this command to re-register ASP.NET 4.5, since some other installation un-registered it: ASP.NET 4.5 is installed already.

Using the UI (Add/Remove roles/features), inspired by the referenced posts, I found that it suffices to remove WCF's HTTP Activation feature and then add it again. (But I needed to uninstall/reinstall a feature that happens to depend on WCF HTTP Activation...)

Question: How can this same thing be done through the command line on Windows Server 2012?

(I looked at this dism.exe thing, but it looks daunting, and dism.exe -? didn't help me at all.)

Thanks!

Electric answered 13/5, 2013 at 14:38 Comment(0)
Z
4

Dism would be the best way to do this:

Dism /online /Disable-Feature /FeatureName:WCF-HTTP-Activation45
Dism /online /Enable-Feature /FeatureName:WCF-HTTP-Activation45

Use the /all switch when enabling to enable all parent features.

Zuleika answered 22/4, 2015 at 22:13 Comment(0)
E
3

This error seems to occur when you install the .NET framework core feature which is .NET 3.5 over CLR 2.0 including HTTP activation on a Windows 2012 or 2012 R2 server which already had the .NET framework 4.5 version installed.

In our case the suggested fixes did not work.

We had a CLR 4.0 website that was showing the error:

Could not load type 'System.ServiceModel.Activation.HttpModule' from assembly 'System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'

Removing and re-adding the ASP.NET 4.5 features made no difference.

We had to remove and re-add the 3.5 features using DISM:

Dism /online /Disable-Feature /FeatureName:WCF-HTTP-Activation
Dism /online /Enable-Feature /FeatureName:WCF-HTTP-Activation

You could also use PowerShell:

Remove-WindowsFeature -Name NET-HTTP-Activation
Add-WindowsFeature -Name NET-HTTP-Activation
Edgell answered 1/2, 2016 at 12:2 Comment(0)
E
0

You need to use Server Manager dashboard to add/remove roles/features. Look for IIS-->WebServer-->Application Development--> ASP.NET 4.5

Exhilaration answered 11/7, 2013 at 9:5 Comment(1)
He mentioned that he is able to do that already. He is asking for a command line alternative to using aspnet-regiis. This answer is irrelevant!Rapids

© 2022 - 2024 — McMap. All rights reserved.