2016-08-23 17 views
1

私はspringbootプロジェクトをAzure App Serviceにデプロイしようとしています。 私はApp Serviceを作成し、チュートリアルで述べたようにtest.warとweb.configという2つのファイルをFTP経由でアップロードしました。Azure AppサービスへのSpringbootのデプロイ

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> 

私は、サイト/ wwwrootのにwarファイルをアップロードし、そこにもweb.configファイルを置いています。

質問:私はwarファイルをどのように実行するのですか?自動的にデプロイが完了したらどうなるのでしょうか?今私が得るすべては503

おかげ

答えて

2

@ItaiSoudryは、あなたのweb.configファイルの内容によると、あなたが埋め込まれたTomcatなどの組込みサーブレットコンテナを使用したいかと思われるサービスを使用できません、HTTPエラーです原因桟橋は、春のブートWebアプリケーションを起動する。

使用しているIDEがEclipseであると仮定して、WARファイルではなく、実行可能なjarファイルとしてSpringブートプロジェクトをエクスポートする必要があります。下の図を参照してください。

enter image description here

enter image description here

注:Launch configurationは、主な機能はSpringApplication.runが含まれているクラスを選択する必要があります。

はまた、あなたが%HTTP_PLATFORM_PORT% Azureのアプリケーションサービスはweb.configファイルに引数--server.port=%HTTP_PLATFORM_PORT%を介してサポートや値System.getenv("HTTP_PLATFORM_PORT")でクラスServerPropertiesのポートを設定するとリスンポートを設定する必要があります。

web.configのサンプルは--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 &quot;%HOME%\site\wwwroot\test.jar&quot;"> 
    </httpPlatform> 
    </system.webServer> 
</configuration> 

あなたはWARファイルをデプロイする場合は、パスwwwroot/webappsにwarファイルをアップロードし、その後、Azureのポータル上のアプリサービスのApplicationSettingsを設定する必要があります。参考文献として

enter image description here

、以下の文書を参照してください。

  1. https://azure.microsoft.com/en-us/documentation/articles/web-sites-java-custom-upload/#application-configuration-examples
  2. Create a Java web app in Azure App Service

はそれが役に立てば幸い記事でSpringbootサブセクション。

関連する問題