How can I check whether with ASP.NET 4 is registered to run in IIS 7.5?

China☆狼群 提交于 2019-12-07 01:50:30

问题


How can I check whether with ASP.NET 4 is registered to run in IIS 7.5?

There must be some way to determine this for sure, other than running

aspnet_regiis -i

from within the framework's folder.

I don't need to check this programmatically, just via IIS Manager or the commend line. I have an .NET page that is returing a 500 error, which I have determined could be due to ASP.NET 4 not being registered with IIS.

However, I want to be certain before I make changes to the server configuration.


回答1:


Try to run aspnet_regiis with parameter -lv, i.e.:

C:\Windows\Microsoft.NET\Framework\v4.0.30319>aspnet_regiis -lv

This will give you the following output:

Microsoft (R) ASP.NET RegIIS version 4.0.30319.34209
Administration utility to install and uninstall ASP.NET on the local machine.
Copyright (C) Microsoft Corporation.  All rights reserved.
2.0.50727.0             C:\Windows\Microsoft.NET\Framework64\v2.0.50727\aspnet_isapi.dll
4.0.30319.0             C:\WINDOWS\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll
4.0.30319.0             C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll

In this example, you can see that v4.0.30319.0, 32 and 64 bit dll's, are installed. To install the latest version, for example after applying a .NET Framework update, use

C:\Windows\Microsoft.NET\Framework\v4.0.30319>aspnet_regiis -iru

Note: On 64 bit IIS servers, you need to use "Framework64" instead of "Framework" in the paths above. Strangely, I found on some servers with 64 bit "Framework" in the path worked, on others I had to use "Framework64" - simply try it out. If the registration does not work, run it again with "Framework64" in the path, it does not harm. In one case, I had to change the path using cd C:\Windows\Microsoft.NET\Framework, then I typed aspnet_regiis -iru to make it finally work.


You mentioned that you need to check it programmatically: The command above can be used in a batch file, and via this article you can find the string "4.0.30319.0" in the output (provided you're using "aspnet_regiis -lv > outputfile.txt" to write the output into a text file).




回答2:


appcmd list config /section:globalModules /text:[name='ManagedEngine'].image


来源:https://stackoverflow.com/questions/9828430/how-can-i-check-whether-with-asp-net-4-is-registered-to-run-in-iis-7-5

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!