【问题标题】:setting the webapp %PATH% environment variable in azure在 azure 中设置 webapp %PATH% 环境变量
【发布时间】:2016-11-29 06:09:09
【问题描述】:

我正在开发一个 azure webapp 项目。为了让我的应用程序正常工作,我需要在服务器上安装第三方开源软件。我发现在 azure webapp 上执行此操作的唯一方法是手动复制项目中软件的所有文件夹,然后添加所有必需的环境变量,并向路径系统变量添加一些路径。 我找到了如何添加系统变量,但我找不到在 azure webapp 上设置路径变量的方法。

【问题讨论】:

    标签: azure system-variable


    【解决方案1】:

    您可以通过 XDT 转换XML Document T转换)来实现。 p>

    查看https://github.com/projectkudu/kudu/wiki/Xdt-transform-samples

    添加环境变量

    下面将注入一个名为FOO,值为BAR的环境变量,并在PATH中添加一个文件夹:

    <?xml version="1.0"?> 
    <configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform"> 
      <system.webServer> 
        <runtime xdt:Transform="InsertIfMissing">
          <environmentVariables xdt:Transform="InsertIfMissing">
            <add name="FOO" value="BAR" xdt:Locator="Match(name)" xdt:Transform="InsertIfMissing" />    
            <add name="PATH" value="%PATH%;%HOME%\BAR" xdt:Locator="Match(name)" xdt:Transform="InsertIfMissing" />    
          </environmentVariables>
        </runtime> 
      </system.webServer> 
    </configuration>
    

    将其作为d:\home\site\applicationHost.xdt 放入,重新启动Web App 并在Kudu (https://sitename.scm.azurewebsites.net/DebugConsole) 中检查新修改的%PATH%

    d:\home>set PATH
    Path=D:\home\site\deployments\tools;[...];D:\home\BAR
    

    【讨论】:

    • 这正是我想要的。
    猜你喜欢
    • 2012-10-01
    • 2014-04-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-02-01
    • 1970-01-01
    相关资源
    最近更新 更多