Best practice for Deployment of Web site into a cloud service

痞子三分冷 提交于 2019-12-06 07:26:30

问题


What's the best practice to deploy multiple Web site on Cloud Service ?

I have three web sites, is it possible to deploy those three web sites into one Cloud Service ? (Three instances in one Cloud Service)

Or Do I have to create three Cloud services and deploy each web site separetly ?

Thank you

My ServiceDefinition file:

  <WebRole name="WebRoleName" vmsize="ExtraSmall">
    <Sites>
      <Site name="Web" physicalDirectory="../WebSite1">
        <Bindings>
          <Binding name="Endpoint1" endpointName="Endpoint1" />
        </Bindings>
      </Site>
      <Site name="Web2" physicalDirectory="..\..\..\WebSite2">
        <Bindings>
          <Binding name="Endpoint2" endpointName="Endpoint2" />
        </Bindings>
      </Site>
    </Sites>
    <Endpoints>
      <InputEndpoint name="Endpoint1" protocol="http" port="80" />
      <InputEndpoint name="Endpoint2" protocol="http" port="81" />
    </Endpoints>
    <Imports>
      <Import moduleName="Diagnostics" />
      <Import moduleName="RemoteAccess" />
      <Import moduleName="RemoteForwarder" />
    </Imports>
  </WebRole>
</ServiceDefinition>

By using that code, WebSite1 is available and WebSite2 is not, even by adding :81 I used the Remote Desktop to validate the deployment on IIS, and I saw that WebSite1 was correctly deployed but WebSite2 was not. WebSite2 and WebSite2.Test were two folders deployed below the Virtual Website Directory. By Copying manually the content, of the WebSite2 folder, below the Virtual WebSite Directory, i was able to access to my website via http://ID.cloudapp.net:81

What's the error ? Why the Test project is also deployed for WebSite2 ? (I made a check on the depedency and that's not selected)

Thank you


回答1:


You could do either way. It really depends on what you need to do. If you want to host all your websites on port 80 under the same url for example:

http://www.mywebsite.com/site1
http://www.mywebsite.com/site2
http://www.mywebsite.com/site3

then you can try this:

http://kellyhpdx.wordpress.com/2012/04/11/deploying-multiple-web-applications-to-a-single-azure-instance-and-applying-web-config-transforms-correctly/

Alternatively if you don't necessarily need this implementation and you can host your websites under different ports, then you could create one instance under a separate role.

You could even have 1 cloud project per webrole, for instance if you wanted to have a test admin website to control your project, which shouldn't be included in production, you could have 2 cloud projects: 1 with all the production instances and 1 with your test admin website that you deploy as and when needed.




回答2:


You'll have to manually modify the .csdef file for your Azure project to add multiple sites into the cloud service. Wade Wegner posted a good article on how to do so. Note that each site must have a unique host header.



来源:https://stackoverflow.com/questions/15225301/best-practice-for-deployment-of-web-site-into-a-cloud-service

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!