Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/azure/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 将Springboot部署到Azure应用程序服务_Java_Azure_Web Applications_Spring Boot - Fatal编程技术网

Java 将Springboot部署到Azure应用程序服务

Java 将Springboot部署到Azure应用程序服务,java,azure,web-applications,spring-boot,Java,Azure,Web Applications,Spring Boot,我正在尝试将我的springboot项目部署到Azure应用程序服务中。 我创建了一个应用程序服务,并通过FTP上传了两个文件:test.war和web.config,正如他们在教程中提到的那样 web.config <?xml version="1.0" encoding="UTF-8"?> <configuration> <system.webServer> <handlers> <add name="httpPl

我正在尝试将我的springboot项目部署到Azure应用程序服务中。 我创建了一个应用程序服务,并通过FTP上传了两个文件:test.war和web.config,正如他们在教程中提到的那样

web.config

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <system.webServer>
    <handlers>
      <add name="httpPlatformHandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified" />
    </handlers>
    <httpPlatform processPath="%JAVA_HOME%\bin\java.exe"
        arguments="-Djava.net.preferIPv4Stack=true -Dserver.port=%HTTP_PLATFORM_PORT% -jar   &quot;%HOME%\site\wwwroot\test.war&quot;">
    </httpPlatform> 
  </system.webServer>
</configuration>

我正在将war文件上载到站点/wwwroot,并将web.config文件也放在那里

我的问题是:如何执行war文件?当我自动完成部署时应该发生吗?因为现在我得到的只是服务不可用,Http错误503


感谢

@ItaiSoudry,根据
web.config
文件的内容,您似乎希望使用嵌入式servlet容器(如嵌入式tomcat或jetty)来启动spring boot web应用程序

假设您使用的IDE是Eclipse,您需要将spring引导项目导出为可运行的jar文件,而不是war文件,请参见下图

注意:
Launch配置
应选择主函数包含的类
SpringApplication.run

同时,您需要使用
%HTTP\u PLATFORM\u port%
通过
web.config
文件中的参数
--server.port=%HTTP\u PLATFORM\u port%
配置侦听端口,或者使用值
System.getenv(“HTTP\u PLATFORM\u port”)
设置类的端口

下面是一个使用
--server.port=%HTTP\u PLATFORM\u port%
web.config
示例

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
  <system.webServer>
    <handlers>
      <add name="httpPlatformHandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified" />
    </handlers>
    <httpPlatform processPath="%JAVA_HOME%\bin\java.exe"
        arguments="-Djava.net.preferIPv4Stack=true -Dserver.port=%HTTP_PLATFORM_PORT% -jar &quot;%HOME%\site\wwwroot\test.jar&quot;">
    </httpPlatform>
  </system.webServer>
</configuration>

作为参考,请参考以下文件

  • 本文中的
    Springboot
    小节

  • 希望有帮助。

    这里我已经给出了详细的步骤,请检查-