Windows Server 2008安装IIS 7与配置

时间:2023-03-09 16:21:02
Windows Server 2008安装IIS 7与配置

一、安装IIS 7

1、鼠标右键【我的电脑(Computer)】→【管理(Manager)】

Windows Server 2008安装IIS 7与配置

2、选择【角色(Roles)】,右键【添加角色(Add Roles)】,弹出【添加角色向导(Add Roles Wizard)】选择【下一步(Next)】

Windows Server 2008安装IIS 7与配置

Windows Server 2008安装IIS 7与配置

3、勾选【Web服务器IIS(Web Server IIS)】

Windows Server 2008安装IIS 7与配置

Windows Server 2008安装IIS 7与配置

4、勾选需要安装的角色服务(Server Roles)

Windows Server 2008安装IIS 7与配置

Windows Server 2008安装IIS 7与配置

Windows Server 2008安装IIS 7与配置

5、选择完角色服务后,点击【安装(Install)】等待安装完成

Windows Server 2008安装IIS 7与配置

Windows Server 2008安装IIS 7与配置

Windows Server 2008安装IIS 7与配置

二、IIS配置相关

1、IIS应用池添加.NET Framework 4.0:

解决以下问题:

HTTP Error 500.21 - Internal Server Error

Handler "ExtensionlessUrlHandler-Integrated-4.0" has a bad module "ManagedPipelineHandler" in its module list

1)【开始】菜单→【运行】→C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe –i  (或 %windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe -i)

2) 打开【Internet Information Services (IIS) Manager】,选择【Application Pools】→【Classic .NET AppPool】和【DefaultAppPool】,修改.NET Framework的版本

Windows Server 2008安装IIS 7与配置

2、让Windows 64位的操作系统,兼容32位应用程序:应用程序池【DefaultAppPool】→选择【高级设置】→【启用32位应用程序】设置为 True即可。

Windows Server 2008安装IIS 7与配置

Windows Server 2008安装IIS 7与配置

3、让IIS支持svg/woff/woff2字体

1)打开【Internet Information Services (IIS) Manager】,选择某个网站→【MIME类型(MIME Types)】

Windows Server 2008安装IIS 7与配置

2)添加MIME类型

  文件扩展名   MIME类型

  .svg       image/svg+xml

  .woff      application/x-font-woff

  .woff2      application/x-font-woff

Windows Server 2008安装IIS 7与配置

4、解决iis 7上发布mvc报错:403.14-Forbidden Web 服务器被配置为不列出此目录的内容

         HTTP Error 403.14 - Forbidden

         The Web server is configured to not list the contents of this directory.

1)解决方法一:

  • 如果不希望启用目录浏览,请确保配置了默认文档并且该文件存在。
  • 使用 IIS 管理器启用目录浏览。
    •  打开 IIS 管理器。
    •  在“功能”视图中,双击“目录浏览”。
    •  在“目录浏览”页上,在“操作”窗格中单击“启用”。
  • 确认站点或应用程序配置文件中的 configuration/system.webServer/directoryBrowse@enabled 特性被设置为 True。

2)解决方法二:修改配置文件web.config

  <system.webServer>
    <validation validateIntegratedModeConfiguration="false"/>
    <modules runAllManagedModulesForAllRequests="true" />
  </system.webServer>

设置<modules>节的值为true就可以了, 而目录浏览启用或禁用都不受影响。