Win10开启IIS并设置.net4.5框架

一.开启IIS

控制面板 -> 程序 -> internet Infomation Services

iis

这里我打开后的版本为IIS10

二.开启.net4.5

二.1 确认已安装framework版本

首先确定您电脑是否安装该版本框架,具体信息参考微软官网

  1. 通过命令确定是否安装
(Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full").Release -ge 394802
//确定是否已安装 .NET Framework 4.6.2 或更高版本
  1. 通过组册吧确定
regedit
// 打开注册表

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\FullRelease条目值大于378389即可确定安装了大于4.5的框架

二.2 开启iis后默认只有.net4.0作为程序运行池子

  1. 通过一下命令打开.net4.5运行池
// aspnet_regiis.exe -i

dism /online /enable-feature /featurename:IIS-ISAPIFilter
dism /online /enable-feature /featurename:IIS-ISAPIExtensions
dism /online /enable-feature /featurename:IIS-NetFxExtensibility45
dism /online /enable-feature /featurename:IIS-ASPNET45

如出现以下报错

The operation is complete but IIS-ASPNET45 feature was not enabled.

A required parent feature may not be enabled. You can use the /enable-feature /all option to automatically enable each parent feature fr
om the following list. If the parent feature(s) are already enabled, refer to the log file for further diagnostics.                     
IIS-ISAPIFilter, IIS-ISAPIExtensions, IIS-NetFxExtensibility45

执行

dism /online /enable-feature /featurename:IIS-NetFxExtensibility45
dism /online /enable-feature /featurename:NetFx4Extended-ASPNET45
dism /online /enable-feature /featurename:IIS-ASPNET45

// 我是通过如上命令开启的

iis4

dism /online /Get-Features 查看已安装产品

  1. 也可尝试通过控制面板安装

iis3