2013-05-13 86 views
6

正如幾個問題(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)文件,在Windows服務2012 aspnet_regiis -ir命令不工作了,而是產生以下的輸出:什麼是Windows Server 2012命令行相當於`aspnet_regiis -ir`?

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 .

在我們的例子中,我們只需要運行此命令重新註冊ASP.NET 4.5,因爲其他安裝未註冊它:ASP.NET 4.5已安裝。

使用UI(添加/刪除角色/功能),受到引用帖子的啓發,我發現只需刪除WCF的HTTP激活功能並再次添加即可。 (但我需要卸載/重新安裝恰好依賴於WCF HTTP激活的功能......)

問題:在Windows Server 2012上如何通過命令行完成同樣的事情?

(我看着這個dism.exe東西,但它看起來令人生畏,而dism.exe -?沒有幫助我的人。)

謝謝!

回答

0

您需要使用服務器管理器儀表板來添加/刪除角色/功能。 查找IIS - > Web服務器 - >應用程序開發 - > ASP.NET 4.5

+1

是不是真正的問題... – 2014-04-04 07:04:41

+1

他提到,他已經能夠做到這一點。他正在尋求一種替代使用aspnet-regiis的命令行。這個答案是無關緊要的! – 2017-12-12 07:54:46

4

複製Dism會做到這一點的最好辦法:

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

使用/所有交換機能夠使當所有父母功能。

1

當您安裝.NET 3.5 over CLR 2.0的.NET框架核心功能(包括已安裝.NET Framework 4.5版本的Windows 2012或2012 R2服務器上的HTTP激活)時,似乎會發生此錯誤。

在我們的情況下,建議的修復程序不起作用。

我們有一個CLR 4.0網站,是顯示錯誤:

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

刪除並重新添加ASP.NET 4.5的功能沒有什麼區別。

我們不得不刪除,並使用DISM重新添加3.5功能:

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

你也可以使用PowerShell:

Remove-WindowsFeature -Name NET-HTTP-Activation 
Add-WindowsFeature -Name NET-HTTP-Activation