重新安装IIS或者装了.net之后才发现IIS还没有装。可以用这种方法解决。
To fix IIS mappings for ASP.NET, run the Aspnet_regiis.exe utility:
-
Click Start, and then click Run.
-
In the Open text box, type cmd, and then press ENTER.
-
At the command prompt, type the following, and then press ENTER:"%windir%/Microsoft.NET/Framework/ version/aspnet_regiis.exe" -iIn this path, version represents the version number of the .NET Framework that you installed on your server. You must replace this placeholder with the actual version number when you type the command.
-i 参数适用于IIS带的版本比.NET低,或者相同的情况。
如果不小心装了一个高版本的.NET,特别是.NET 4.0,有需要使用.NET 2.0作为IIS的默认版本,需要使用aspnet_regiis.exe -r。
-i的作用是安装,所以不会覆盖高版本的信息
-r的作用是强制覆盖称当前.Net版本,不管原来版本高低。