Azure部署WAR文件显示空白页

时间:2018-06-22 08:30:58

标签: java maven azure

我正在开发一个简单的Web应用程序,需要将其作为应用程序服务部署到Azure。

这是一个Spring Boot项目,我已经按照此网站上的说明进行操作: https://docs.microsoft.com/en-us/java/azure/spring-framework/deploy-spring-boot-java-app-with-maven-plugin

我做了几处更改,例如向pom.xml添加了一些配置,以便选择正确的订阅。当我运行mvn azure-webapp:deploy时,它没有错误地完成,并且我看到一堆东西已上传。但是,当我通过给定的URL xxx.azurewebsites.net访问我的网站时,我得到的只是一个Error 404。我什至尝试了用于Intellij的Azure工具包,它已成功完成,但网站仍然显示错误。

我已经看了几个小时的youtube视频和很多教程,我看不到我错过了任何步骤。

1 个答案:

答案 0 :(得分:1)

结合official tutorials中的步骤和我的部署过程,我为您提供以下检查点:

要点1: :请使用mvn packagepom.xml文件所在的目录中建立JAR软件包。

enter image description here]

要点2: 。请确保在web.config中配置的jar包名称与上载的jar包名称相同。

enter image description here

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\<your project name>&quot;">
    </httpPlatform>
  </system.webServer>
</configuration>

要点3:。请使用FTP将jar filesweb.config发布到KUDU上的D:\home\site\wwwroot\目录。

第4点: 请确保ApplicationSettings与您的项目匹配,例如jdk versiontomcat version

enter image description here

如果要部署war文件,则需要在Azure门户上配置应用程序服务的ApplicationSettings,然后将war文件上传到路径D:\home\site\wwwroot\webapps

此外,您可以检查KUDU上的日志文件:https://<your project name>.scm.azurewebsites.net/DebugConsole.

作为参考,请参考下面的文档和主题。

1。Configure web apps in Azure App Service

2。Create a Java web app in Azure App Service

3。Deploying Springboot to Azure App Service

希望它对您有帮助。

相关问题