【点滴积累】使用IIS Express
来源:互联网 发布:蚂蚁金服 java 工资 编辑:程序博客网 时间:2024/06/05 02:05
1.IIS Express 概述
IIS Express是一个微软推出的一款免费,且小型、轻量特别适合ASP.NET开发人员使用的Web开发服务器。在没有IIS Express之前,开发人员只能使用下面两种方案:
- Visual Studio自带的ASP.NET开发服务器
- Windows的IIS Web服务器
既然已经有了这两个选择,为什么还要推出IIS Express呢?这是由于这两个方案的不足决定的,如下:
- Visual Studio自带的Web服务器并没有提供完整的Web服务器功能(例如:不支持SSL、URL重写规则等)
- Visual Studio自带的Web服务器并不支持外部访问
- 使用IIS首先需要管理员账号来安装和调试
- 不同版本的Windows对支持IIS的版本也不相同(Windows XP就不能使用IIS7.x的新功能)
但是IIS Express集成了这两种方案的优点,又避免的他们的缺点
- 首先,IIS Express除了没有IIS的可视化管理界面,几乎用于其全部的功能
- 其次,IIS Express经过简单的配置后也可以在Visual Studio 2010中使用(VS2012已经内置了IIS Express 8)
- 再者,IIS Express相对于IIS支持更多版本的Windows系统(在Windows XP下可以使用IIS Express 7.5)
2.使用IIS Express部署一个Web应用程序
使用IIS Express部署一个站点非常简单,只需要修改Express的applicationhost.config配置文件即可,该文件用于承载站点的定义、应用程序、应用程序池和整个WEB服务器的配置。文件的默认位置在:C:\Users\UserName(用户名)\Documents\IISExpress\config目录下,打开该配置文件我们可以看到IIS Express支持下面五种应用程序池:分别是.NET 2.0和.NET 4.0的集成版和经典版,以及一个非托管的版本:
1 <applicationPools>2 <add name="Clr4IntegratedAppPool" managedRuntimeVersion="v4.0" managedPipelineMode="Integrated" CLRConfigFile="%IIS_USER_HOME%\config\aspnet.config" autoStart="true" />3 <add name="Clr4ClassicAppPool" managedRuntimeVersion="v4.0" managedPipelineMode="Classic" CLRConfigFile="%IIS_USER_HOME%\config\aspnet.config" autoStart="true" />4 <add name="Clr2IntegratedAppPool" managedRuntimeVersion="v2.0" managedPipelineMode="Integrated" CLRConfigFile="%IIS_USER_HOME%\config\aspnet.config" autoStart="true" /> 5 <add name="Clr2ClassicAppPool" managedRuntimeVersion="v2.0" managedPipelineMode="Classic" CLRConfigFile="%IIS_USER_HOME%\config\aspnet.config" autoStart="true" /> 6 <add name="UnmanagedClassicAppPool" managedRuntimeVersion="" managedPipelineMode="Classic" autoStart="true" /><applicationPoolDefaults managedRuntimeLoader="v4.0">7 <processModel />8 </applicationPoolDefaults>9 </applicationPools>
现在我们来看最重要的sites节点,每个site节点表示一个站点,其中:bindingInformation节点由三个部分组成:绑定的IP:端口:主机名称。
1 <sites> 2 <site name="IIS Express" id="1" serverAutoStart="true"> 3 <application path="/"> 4 <virtualDirectory path="/" physicalPath="%IIS_SITES_HOME%\WebSite1" /> 5 </application> 6 <bindings> 7 <binding protocol="http" bindingInformation=":8080:localhost" /> 8 </bindings> 9 </site>10 <sites>
现在我们可以开始部署Web应用程序了,将发布好的Web应用程序放到指定目录(在我这里我将其放到D盘的WebAPP目录下面),然后修改上面的配置文件,比如选择绑定的端口,选择Web应用程序对于的.NET应用程序池即可:
1 <site name="WebSite" id="2" serverAutoStart="true">2 <application path="/" applicationPool="Clr4IntegratedAppPool">3 <virtualDirectory path="/" physicalPath="D:\WebApp" />4 </application>5 <bindings>6 <binding protocol="http" bindingInformation="*:8081:*" />7 </bindings>8 </site>
启动IIS Express,在浏览器中输入:http://localhost:8081/访问Web应用程序:
3.配置IIS Express 使其能够进行外部访问
首先是需要将Web应用程序使用的端口号在Windows防火墙中设置允许通过,其次是修改site节点下的binding节点的bindingInformation属性:
<bindings> <binding protocol="http" bindingInformation="*:8081:*" /> </bindings>
最后,需要以管理员身份启动IIS Express即可,使用Ip地址进行访问:
参考资料&进一步阅读
http://msdn.microsoft.com/zh-cn/ff844168
http://www.cnblogs.com/nicch/archive/2011/03/20/1989192.html
<script type="text/javascript"><!--google_ad_client = "ca-pub-1944176156128447";/* cnblogs 首页横幅 */google_ad_slot = "5419468456";google_ad_width = 728;google_ad_height = 90;//--></script><script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
- 点滴积累--使用IIS Express
- 【点滴积累】使用IIS Express
- IIS Express 使用记录
- 点滴积累-redis的使用
- IIS Express 使用详细说明
- 点滴积累
- 点滴积累
- 点滴积累
- 点滴积累
- 点滴积累
- 点滴积累
- Java进阶:JNI使用技巧点滴积累
- [点滴积累]vim使用(1)(FromQQ)
- VS2013 IIS Express 使用自定义的域
- vs2015 使用64位IIS EXPRESS调试
- IIS Express
- IIS积累
- JSF点滴积累--使用Tinymce的HTML编辑器
- 利用javabean+jsp写的简单计算器(附加图片)
- 什么是内容类型?
- ORACLE游标讲解
- C# WPF 快速开发11导入txt数据到数据库
- Java抽象类用法示例详解
- 【点滴积累】使用IIS Express
- Win7运行vc++6.0打开显示Microsoft(R) Developer Studio已停止工作解决方法
- C# WPF 快速开发12批量数据插入数据库
- hdu 2377Bus Pass
- C# WPF 快速开发13三层架构简单版
- The configuration may be corrupt or incomplete
- java Timer计时器在android中运行时出现的问题
- linux头文件
- 解析Aspx文件(asp.net)