【Azure 应用服务】在Azure App Service for Windows 中部署Java web项目时候,需要在wwwroot下设置web.config

时间:2020-12-28 11:53:10   收藏:0   阅读:0

问题描述

在Azure App Service for Windows 中部署Java web项目时候,需要在wwwroot下设置web.config,而争对Jar包,war包则有不同的设置方式,一下两段web.config的内容分别对应Jar 和War包

 

方式一: 启动Jar包的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" stdoutLogEnabled ="true" stdoutLogFile="%home%\LogFiles\stdout"
        arguments="-Djava.net.preferIPv4Stack=true -Dserver.port=%HTTP_PLATFORM_PORT% -jar &quot;%HOME%\site\wwwroot\my-web-project.jar&quot; "  >    
   </httpPlatform>   </system.webServer> </configuration>

 

方式二: 启动War包的Web.config

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <handlers>
            <add name="httppPlatformHandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified" />
        </handlers>
        
        <httpPlatform processPath="%AZURE_TOMCAT8_HOME%\bin\startup.bat">
        </httpPlatform>
    </system.webServer>
</configuration>

 

 

参考资料

Java sample for Azure App Service: https://github.com/Azure-Samples/app-service-web-java-get-started

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!