【问题标题】:no webpage was found for the web address in azure在 azure 中找不到该网址的网页
【发布时间】:2020-01-22 11:15:11
【问题描述】:

我正在尝试将 spring boot 应用程序的 war 文件部署到 azure 应用程序服务。它部署成功。但是当我打开网址时,我得到了

This appname.azurewebsites.net page can’t be found.

No web page was found for the web address:https://appname.azurewebsites.net/.

我在localhost:9001 中看到了登录页面,但我在 azure 中收到了上面提到的 404 错误。我对春天不太了解。我只是想部署应用程序。是否有一些地方我应该指定在加载 appname.azurewebsites.net 时应该提供哪个页面?

不过,它可以在 localhost 中使用。我做错了什么?

我只上传了war 文件。我还没有做任何其他事情来托管 azure 的应用服务的 tomcat。 我还应该做些什么来让它在 Azure 上运行?

【问题讨论】:

    标签: java spring azure spring-boot


    【解决方案1】:

    按照以下步骤操作:

    • 将 Spring Boot 应用程序打包为 JAR 文件。 (可以在 pom.xml 中使用<packaging> 元素)
    • 将JAR文件上传到WebApp的D:\home\site\wwwroot
    • 将 JAR 文件重命名为 app.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"
                          arguments="-Djava.net.preferIPv4Stack=true -Dserver.port=%HTTP_PLATFORM_PORT% -jar &quot;%HOME%\site\wwwroot\app.jar&quot;">
            </httpPlatform>
        </system.webServer>
    </configuration>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-05-31
      • 1970-01-01
      • 2020-05-05
      • 1970-01-01
      • 2019-11-15
      • 1970-01-01
      • 1970-01-01
      • 2020-12-05
      相关资源
      最近更新 更多