在天蓝色中设置webapp%PATH%环境变量 [英] setting the webapp %PATH% environment variable in azure

查看:82
本文介绍了在天蓝色中设置webapp%PATH%环境变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在做一个天蓝色的webapp项目.为了使我的应用程序正常运行,我需要在服务器上安装第三方开源软件.我发现在azure webapp上执行此操作的唯一方法是手动复制项目中该软件的所有文件夹,然后添加所有必需的环境变量,并且还向path系统变量添加了很少的路径.我找到了添加系统变量的方法,但是找不到在Azure Web应用程序上设置路径变量的方法.

I am working on an azure webapp project. In order for my application to work, I needed to install a third party open source software on the server. The only way that I found to do that on the azure webapp, was to manually copy all the folders of the software on my project and then add all the required environment variables and also add few paths to the path system variable. I found how I can add the system variables, but I could not find the way to set the path variable on azure webapp.

推荐答案

您可以通过 XDT转换( X ML D 记录 T 转换).

You can achieve that through an XDT Transform (XML Document Transform).

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

添加环境变量

以下内容将注入一个名为 FOO 且值为 BAR 的环境变量,并将一个文件夹添加到PATH:

Adding environment variables

The following will inject an environment variable named FOO, with value BAR, and add a folder to the 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中新修改的%PATH%( https://站点名称 .scm.azurewebsites.net/DebugConsole ).

Drop it in as d:\home\site\applicationHost.xdt, restart the Web App and check the freshly amended %PATH% in Kudu (https://sitename.scm.azurewebsites.net/DebugConsole).

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

这篇关于在天蓝色中设置webapp%PATH%环境变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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