Azure 应用服务】App Service 部署txt静态文件和Jar包在不同目录中的解决办法 - LuBu0505/My-Code GitHub Wiki
在Web App wwwroot (Windows系统中)根目录下如何部署一个jar包和一个text文件,让两个文件都能被访问?
Jar包和Text文件都分别放置在两个单独的文件夹中,并且在各自的文件夹中添加web.config来指明启动方式。
web.config内容如下:
<?xml version="1.0"?>
<configuration>
<system.webServer>
<handlers>
<clear />
<add name="StaticFile" path="*" verb="*" modules="StaticFileModule,DefaultDocumentModule,DirectoryListingModule" resourceType="Either" requireAccess="Read" />
</handlers>
</system.webServer>
</configuration>
web.config内容如下:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="httpPlatformHandler" path="*" verb="*" modules="httpPlatformHandler" resourceType="Unspecified" />
</handlers>
<!-web app的java.exe路径和jar包存放的路径->
<httpPlatform processPath="C:\Program Files\Java\zulu11.48.21-jre11.0.11-win_x64\bin\java.exe" arguments="-Djava.net.preferIPv4Stack=true -Dserver.port=%HTTP_PLATFORM_PORT% -jar "%HOME%\site\wwwroot\test1\test.jar"" >
</httpPlatform>
</system.webServer>
</configuration>
Java HttpPlatformHandler Configuration Examples :https://docs.microsoft.com/zh-cn/iis/extensions/httpplatformhandler/httpplatformhandler-configuration-reference#httpplatformhandler-configuration-examples