Change approot path of Windows Azure WebRole

南楼画角 提交于 2019-12-25 04:20:07

问题


How is it possible to change the default approot path? E.g. I want to run a PHP Framework whose web root is a sub folder:

  symfony
  |_ app
  |_ bin
  |_ src
  |_ web <- Web root
      |_ index.php

The web root of the WebRole is there:

WebRole <- Web root
 |_ bin
 |_ php
 |_ resources
 |_ WindowsAzureSDKForPHP
 |_ diagnostics.wadcfg
 |_ Global.asax
 |_ Web.config
 |_ index.php
ServiceConfiguration.cscfg
ServiceDefinition.csdef

When bringing both togehter I get:

WebRole
 |_ bin
 |_ php
 |_ resources
 |_ WindowsAzureSDKForPHP
 |_ diagnostics.wadcfg
 |_ Global.asax
 |_ Web.config
 |_ symfony
      |_ app
      |_ bin
      |_ src
      |_ web <- Desired web root
          |_ index.php      
ServiceConfiguration.cscfg
ServiceDefinition.csdef

Is there a way to tell Windows Azure that the web root has changed? (The defaultDocument-setting in the Web.config is not enough).

Edit:

After the suggested changes of astaykov, the structure looks like this:

WebRole
 |_ ServiceConfiguration.cscfg
 |_ ServiceDefinition.csdef
 |_ symfony
      |_ app
      |_ bin
      |_ src
      |_ web <- Desired web root
         |_ bin
         |_ php
         |_ resources
         |_ WindowsAzureSDKForPHP
         |_ diagnostics.wadcfg
         |_ Global.asax
         |_ Web.config
         |_ index.php      

回答1:


Can you try adding it as another site. For example, add the folling site node to your service definition sites element:

 <Site name="symphony" physicalDirectory="../WebRole1/symphony/web">
        <Bindings>
          <Binding name="Endpoint1" endpointName="Endpoint1" hostHeader="www.symphony.com" />
        </Bindings>
  </Site>

You need to replace the "Endpoint1" and "www.symphony.com" with your actual endpoint name and host header. I tested it locally and it works (I tested with regular html files, but having php is not much different).

UPDATE Here is deployed sample:

http://sn.cloudapp.net/

http://symphony.staykov.net/

Please note that symphony.staykov.net is just a CNAME to sn.cloudapp.net.

However when deployed, both sites will reside each in its own subfolder of e:\sitesroot. Don't know if it will be an issue for you. How do you include the symphony files in your web? i.e. require_once('../symphony/something.php') ? This would not really work...

I will upload the sample scaffolded solution and provide a link later today or tomorrow.

UPDATE 2 - sources

You can check the scaffolded source here and the actual deploy package here to begin experimenting. Hope that it will give you some ideas on how to solve your issue.



来源:https://stackoverflow.com/questions/8925139/change-approot-path-of-windows-azure-webrole

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