如何在Azure WebApp上部署多个应用 [英] How to Deploy Multiple Apps on Azure WebApps

查看:164
本文介绍了如何在Azure WebApp上部署多个应用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个要像这样部署在同一Azure WebApp上的不同应用程序:

I have two different applications which I want to deploy on the same Azure WebApp like this:

webapp.azurewebsites.net/api/ <-- run the Java REST API here
webapp.azurewebsites.net/site/ <- put the Angular2 app here

问题

这两个应用程序均已部署在服务器上,但目前我只能使用web.config来运行REST API,如下所示:

Problem

Both apps are deployed on the server but currently I'm only able to get the REST API running with a web.config like this:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <system.webServer>
    <rewrite>
      <rules>
        <rule name="Force HTTPS" enabled="true">
          <match url="(.*)" ignoreCase="false"/>
          <conditions>
            <add input="{HTTPS}" pattern="off"/>
          </conditions>
          <action type="Redirect" url="https://{HTTP_HOST}/{R:1}" appendQueryString="true" redirectType="Permanent"/>
        </rule>
      </rules>
    </rewrite>
    <handlers>
      <add name="httpPlatformHandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified"/>
    </handlers>
    <httpPlatform processPath="%JAVA_HOME%\bin\java.exe"
                  arguments="-jar D:\home\site\wwwroot\webapps\rest-api.war">
    </httpPlatform>
  </system.webServer>
</configuration>

但是我无法访问服务器上的Angular2应用程序,也找不到如何同时配置Java应用程序和Angular2应用程序的文档.

but I'm not able to reach the Angular2 app on the server and I can't find documentation how I would configure the Java application and the Angular2 app at the same time.

我还尝试通过Application settings下Azure仪表盘中的Virtual applications and directories设置来实现此目标-但这没有用,并且我找不到关于如何实现此目标的详尽文档,或者如果这是甚至可以通过设置Virtual applications and directories.

I also tried to achieve this with the Virtual applications and directories settings from the Azure dashboard under Application settings - but it didn't work and I can't find a decent documentation of how I would achieve this, or if this is even possible with setting the Virtual applications and directories.

我试图移动Angular2站点,但是无法配置服务器,以便在Java应用程序运行时可以访问Angular2应用程序.

I tried to move the Angular2 site around but was not able to configure the server so that the Angular2 app is accessible while the Java application is running.

有人可以为我提供有关如何实现此目标的良好文档,还是可以详细描述部署过程(关于配置,例如Azure仪表板中的Application settingsweb.config文件)?

Can someone point me to a good documentation on how to achieve this, or describe the deployment process in detail (with regard to the configs, e.g. the Application settings from the Azure Dashboard and the web.config file)?

推荐答案

根据我的经验,我认为在Azure WebApp上部署多个应用程序的最佳方法是为Azure Webapp设置Application SettingsVirtual applications and directories.参见下图.

Per my experience, I think the best way for deploying multiple Apps on Azure WebApps is to set the Virtual applications and directories of Application Settings for your Azure Webapp, please see the figure below.

作为参考,请参阅SO线程的答案添加虚拟目录到Azure上的现有网站.

As reference, please refer to the answer of the SO thread Add virtual directory to existing website on Azure.

Azure网站支持虚拟目录.有关可以通过Azure管理门户执行的操作,请参阅配置Azure网站.在Azure门户中,单击网站"并转到配置",然后向下滚动到虚拟应用程序和目录(最后一个配置"部分).只需输入您的虚拟目录和相对于站点根目录的物理路径,然后单击保存"即可.

Virtual Directories are supported for Azure Websites. See Configuring Azure Websites for what you can do through the Azure Management Portal. From the Azure Portal, click on the Website and go to Configure, then scroll down to virtual applications and directories (the last config section). Just enter your virtual directory and the physical path relative to the site root and click Save.

这篇关于如何在Azure WebApp上部署多个应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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