更改 Windows Azure WebRole 的 approot 路径 [英] Change approot path of Windows Azure WebRole

查看:29
本文介绍了更改 Windows Azure WebRole 的 approot 路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何更改默认的 approot 路径?例如.我想运行一个 PHP 框架,它的 web 根目录是一个子文件夹:

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

WebRole 的 Web 根在那里:

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

有没有办法告诉 Windows Azure Web 根目录已更改?(Web.config 中的 defaultDocument-setting 是不够的).

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

经过astaykov的建议修改后,结构如下:

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      

推荐答案

您能否尝试将其添加为另一个站点.例如,将以下站点节点添加到您的服务定义站点元素:

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>

您需要将Endpoint1"和www.symphony.com"替换为您的实际端点名称和主机标头.我在本地对其进行了测试并且可以正常工作(我使用常规 html 文件进行了测试,但使用 php 并没有太大区别).

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).

更新这是部署的示例:

http://sn.cloudapp.net/

http://symphony.staykov.net/

请注意,symphony.staykov.net 只是 sn.cloudapp.net 的 CNAME.

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

但是,部署后,两个站点都将驻留在各自的子文件夹 e:\sitesroot 中.不知道对你来说会不会有问题.你如何在你的网络中包含交响乐文件?即 require_once('../symphony/something.php') ?这真的行不通...

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.

更新 2 - 来源

您可以查看 源代码此处开始实验.希望它能给您一些关于如何解决您的问题的想法.

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.

这篇关于更改 Windows Azure WebRole 的 approot 路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆