I\'m trying to deploy my springboot project into Azure App Service. I created an App Service and uploaded via FTP two files: test.war and web.config as mentioned in their tu
@ItaiSoudry, According to the content of your web.config
file, it seems that you want to use the embedded servlet container like embedded tomcat or jetty to start up the spring boot web application.
Assumption that the IDE you used is Eclipse, you need to export your spring boot project as a runnable jar file, not a war file, please see the figure below.
Note: The Launch configuration
should be selected the Class which the main function contains SpringApplication.run
.
Meanwhile, you need to configure the listen port with %HTTP_PLATFORM_PORT%
the Azure App service supported via the argument --server.port=%HTTP_PLATFORM_PORT%
in the web.config
file or set the port of the class ServerProperties with the value System.getenv("HTTP_PLATFORM_PORT")
.
Here is a sample for web.config
with --server.port=%HTTP_PLATFORM_PORT%
.
<?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 "%HOME%\site\wwwroot\test.jar"">
</httpPlatform>
</system.webServer>
</configuration>
If you want to deploy a war file, you need to configure the ApplicationSettings
of your app service on Azure portal, then upload the war file into the path wwwroot/webapps
.
As references, please refer to the documents below.
Springboot
subsection in the article https://azure.microsoft.com/en-us/documentation/articles/web-sites-java-custom-upload/#application-configuration-examplesHope it helps.