问题
I am running a gallery template Windows Server 2012 VM instance on Azure. I've deployed a .NET site to the local IIS 8.0 but it doesn't work, just gives 404's for path that work fine on dev box (IIS Express).
I had a nightmare with Web Deploy already on this VM so I think this whole VM template is screwy.
I want to re-register ASP.NET with IIS using aspnet_regiis.exe but I see this message:
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.
The link goes to a page explaining how to add roles. I haven't the faintest idea how to remove roles.
There is a TechNet article about doing it via PowerShell and has almost a footnote for removing via a GUI, using "The Remove Roles Wizard" - which is nowhere to be found on Server 2012.
How can I remove IIS or ASP.NET or .NET Framework and reinstall it these days? It's so confusing.
In fact, its seem SO impossible, that I'm wondering whether this isn't some customization of the VM template on Azure; there's no way to remove anything.
回答1:
I want to re-register ASP.NET with IIS using aspnet_regiis.exe
simply you can't, you'll need to turn on / off features in windows 2012
- Go to Control Panel,
- Click Programs, and then click Turn Windows features on or off.
- In the Windows Features dialog box, click Internet Information Services to install the default features.
- Expand the Application Development
Features node and click ASP.NET 4.5 to add the features that support ASP.NET. (If you installed .NET 3.5, select ASP.NET 3.5 also.) The following additional features are automatically selected: .NET Extensibility 4.5
- ISAPI Extensions
- ISAPI Filters
- .NET Extensibility 3.5 (If ASP.NET 3.5 was selected)
for the command line take a look at this article and see if that works.
回答2:
Actually you don't need to register framework in iis8. just follow below step to work with framework 4.5.
OR
Run the following command from an administrative command prompt: dism /online /enable-feature /featurename:IIS-ASPNET45
回答3:
Use Get-WindowsFeature to list them and Remove-WindowsFeature to remove them or there is a GUI tool, but its not where you expect.
The problem was that I was using the search tool on the 2012 start screen and typing "features" which gives "Turn Windows features On/Off" which is wrong, because when launched, you cannot turn features off via the tool it presents. That's a Windows UI bug.
I needed to go to Server Manager, Manage menu, Remove Roles and Features!
IMPORTANT
Removing .NET 4.5 from a Windows Server 2012 R2 Azure gallery VM seems to brick the VM, just get a Command Prompt on restart. This happened twice, two VMs dead. Not sure what to do if you need to re-register ASP.NET with IIS. Use Windows 2008?
来源:https://stackoverflow.com/questions/27299995/how-do-i-re-register-asp-net-with-iis-8