【问题标题】:How to set up sites/applications to share same Application Pool on Windows Azure如何设置站点/应用程序以在 Windows Azure 上共享相同的应用程序池
【发布时间】:2012-12-07 18:26:19
【问题描述】:

我正在使用 Windows Azure 在同一个 Web 角色中托管网站和 Web 服务。问题是对于每个站点/应用程序,在 IIS 上创建了一个单独的应用程序池。 有什么办法可以让它们共享一个应用程序池?

这是我的实际 csdef,我在 IIS 中有三个不同的应用程序池(1x 用于 Virtual Application,1x 用于站点 AppWS,1x 用于站点 Web

<WebRole name="Orchard.Azure.Web" vmsize="ExtraSmall">
<Sites>
  <Site name="Web">
    <VirtualApplication name="VAppWS" physicalDirectory="..\..\..\AppWS" />
    <Bindings>
      <Binding name="Binding80" endpointName="Endpoint80" />
      <Binding name="Binding443" endpointName="Endpoint443" />
    </Bindings>
  </Site>
  <Site name="AppWS" physicalDirectory="..\..\..\AppWS">
    <Bindings>
      <Binding name="Binding444" endpointName="Endpoint444" />
    </Bindings>
  </Site>
</Sites>
<Endpoints>
  <InputEndpoint name="Endpoint80" protocol="http" port="80" />
  <InputEndpoint name="Endpoint443" protocol="https" port="443" certificate="ssl.root" />
  <InputEndpoint name="Endpoint444" protocol="https" port="444" certificate="ssl.ws" />
</Endpoints>
...

【问题讨论】:

  • 您是否有任何特殊原因要共享应用程序池?
  • 是的,每个应用程序池都会分配内存。我对此进行了测试,就我而言,每个应用程序池大约有 100MB。我的资源非常有限,这似乎是一种浪费。 (实际上它们托管相同的应用程序。)

标签: iis azure application-pool azure-web-roles


【解决方案1】:

我不知道指定应用程序池的任何方法,因此您必须在 IISConfigurator 完成其工作并重新分配应用程序池后运行一些代码。 您可以使用 Azure 启动任务,但不幸的是它运行得太早 - 在 IISconfigurator 之前。

查看此解决方法:http://mvolo.com/configure-iis-websites-windows-azure-startup-tasks-appcmd/

他创建了一个特殊的异步任务,在 IISConfigurator 之后运行初始化命令。 初始化命令可能是这样的——它将所有应用程序池分配给一个新创建的:

%windir%\system32\inetsrv\appcmd add apppool /name:MyApplicationPool /managedRuntimeVersion:v4.0
%windir%\system32\inetsrv\appcmd list app /xml | %windir%\system32\inetsrv\appcmd set app /in /applicationPool:MyApplicationPool

另一种方法是使用 Microsoft.Web.Administration 程序集在特殊的 Web 应用中进行重新分配。

看看这个例子:http://www.wadewegner.com/2011/01/programmatically-changing-the-apppool-identity-in-a-windows-azure-web-role/

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-01-31
    • 1970-01-01
    • 2021-10-14
    • 1970-01-01
    • 2013-03-19
    • 1970-01-01
    • 1970-01-01
    • 2018-10-23
    相关资源
    最近更新 更多