Windows Azure Cloud Service (23) 使用Full IIS模式部署多站点和虚拟目录
2012-03-10 16:40
701 查看
《Windows Azure Platform 系列文章目录》
本章我们将介绍如何使用Windows Azure的Full IIS模式部署多站点和虚拟目录。
首先我们先新建一个Windows Azure Project,然后添加一个ASP.NET的Web Role。
随后在Solutio里添加一个新的Web Application,命名为WebCRM。注意,这里是直接添加了一个Web Application而不是添加一个新的Web Role。创建完毕后,修改Web CRM下的default.aspx页面,方便我们区分所浏览的页面属于哪个项目。修改如下:
打开ServiceDefinition.csdef,在Sites节点下添加一个新的Site节点,命名为WebSite2,然后通过physicalDirectory属性设置WebCRM项目所在的相对位置。然后制定这个网站绑定的endpoint,修改Binding节点的endpointName属性,设置端口为8080。修改如下:
然后在发布Windows Azure项目之前需要手动编译一下新加入的WebCRM项目。这是因为在Visual Studio的项目依赖关系中并没有把这个WebCRM项目加入到Windows Azure Roles中,因此直接发布Windows Azure项目的话这个WebCRM不会被自动编译。
然后我们按F5来调试效果。
最后我们把这个站点发布到Windows Azure平台上,通过远程桌面进入Azure VM的IIS查看,可以看到IIS中部署了两个web站点:
我们也可以通过IE浏览器访问发布后的web站点
除此之外,用户还可以实现虚拟应用程序和虚拟目录的功能。打开CSDEF文件,在第一个Site节点加入VirtualApplication节点,其name属性设置为LocalCRM,PhysicalDirectory属性设置为WebCRM项目的相对路径。这样,便可以通过这个Web站点的LocalCRM路径访问WebCRM页面。比如http://leiazurefulliis.cloudapp.net/LocalCRM
然后再VirtualApplication节点下面加入虚拟目录,比如可以将Scripts和Styles路径分别指向WebCRM下面的Scripts和Styles路径。完成后的配置文件如下:
然后我们重新发布到Windows Azure平台上。可以看到LocalCRM页面中显示的是运行于WebCRM中的内容。在CSDEF中配置的Virtual Application和Virtual Directory都起了作用。
本章我们将介绍如何使用Windows Azure的Full IIS模式部署多站点和虚拟目录。
首先我们先新建一个Windows Azure Project,然后添加一个ASP.NET的Web Role。
随后在Solutio里添加一个新的Web Application,命名为WebCRM。注意,这里是直接添加了一个Web Application而不是添加一个新的Web Role。创建完毕后,修改Web CRM下的default.aspx页面,方便我们区分所浏览的页面属于哪个项目。修改如下:
打开ServiceDefinition.csdef,在Sites节点下添加一个新的Site节点,命名为WebSite2,然后通过physicalDirectory属性设置WebCRM项目所在的相对位置。然后制定这个网站绑定的endpoint,修改Binding节点的endpointName属性,设置端口为8080。修改如下:
然后在发布Windows Azure项目之前需要手动编译一下新加入的WebCRM项目。这是因为在Visual Studio的项目依赖关系中并没有把这个WebCRM项目加入到Windows Azure Roles中,因此直接发布Windows Azure项目的话这个WebCRM不会被自动编译。
然后我们按F5来调试效果。
最后我们把这个站点发布到Windows Azure平台上,通过远程桌面进入Azure VM的IIS查看,可以看到IIS中部署了两个web站点:
我们也可以通过IE浏览器访问发布后的web站点
除此之外,用户还可以实现虚拟应用程序和虚拟目录的功能。打开CSDEF文件,在第一个Site节点加入VirtualApplication节点,其name属性设置为LocalCRM,PhysicalDirectory属性设置为WebCRM项目的相对路径。这样,便可以通过这个Web站点的LocalCRM路径访问WebCRM页面。比如http://leiazurefulliis.cloudapp.net/LocalCRM
然后再VirtualApplication节点下面加入虚拟目录,比如可以将Scripts和Styles路径分别指向WebCRM下面的Scripts和Styles路径。完成后的配置文件如下:
然后我们重新发布到Windows Azure平台上。可以看到LocalCRM页面中显示的是运行于WebCRM中的内容。在CSDEF中配置的Virtual Application和Virtual Directory都起了作用。
相关文章推荐
- [New Portal]Windows Azure Cloud Service (33) 使用Visual Studio 2012 部署Cloud Service
- Windows Azure Cloud Service (42) 使用Azure In-Role Cache缓存(1)Co-located Role
- Windows Azure Cloud Service (14) 使用Windows Azure诊断收集日志记录数据
- Windows Azure Cloud Service (24) 使用Startup注册COM组件(上)
- [SDK2.2]Windows Azure Cloud Service (35) 使用VS2013发布Azure Cloud Service
- Windows Azure Cloud Service (41) 修改云服务IIS托管管道模式为4.0经典模式
- Windows Azure Cloud Service (3) 把本地的Azure Project部署到云端服务器上
- Windows Azure Cloud Service (20) 使用Internal Endpoint实现Role的内部通信
- Visual Studio2015发布web站点到windows azure Cloud Service(PAAS)
- Windows Azure Cloud Service (43) 使用Azure In-Role Cache缓存(2)Dedicated Role
- Windows Azure Cloud Service (25) 使用Startup注册COM组件(下)
- Windows Azure Cloud Service (40) 使用VS2013的publishSettings文件,发布Cloud Service
- Windows Azure Cloud Service (13) 用Visual Studio 2010 将应用程序部署到Windows Azure平台
- Azure China (3) 使用Visual Studio 2013证书发布Cloud Service至Azure China
- 使用Windows Azure Mobile Service创建定位应用
- Windows Azure Cloud Service (47) 修改Cloud Service时区
- 如何使用 OneAPM 监控微软 Azure Cloud Service ?
- Windows Azure Cloud Service (38) 微软IaaS与PaaS比较
- 关于Windows下Apache使用虚拟主机(多域名多站点)的设置