【问题标题】:How to publish an Angular 2 application into Azure web app?如何将 Angular 2 应用程序发布到 Azure Web 应用程序?
【发布时间】:2020-03-26 04:43:06
【问题描述】:

我按照this link 将我的 Angular 2 应用程序发布到 Azure Web 应用程序中。之后,当我浏览网络应用程序 URL 时,我在 zone.js 文件中遇到了很多问题,当我刷新我的网络应用程序 URL 时,我遇到了不同的错误。

有关我的问题的更多信息,请参阅下图。

但是我的应用程序在我的本地机器上运行没有任何问题。这是我在 index.cshtml 中写的代码

<!DOCTYPE html>
<html>
<head lang="en">

<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Todo List Angular2 Sample</title>

<link href="app/app.component.css" rel="stylesheet" />
<link href="node_modules/bootstrap/dist/css/bootstrap.css" rel="stylesheet" />
<link href="node_modules/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet" />

<!-- Secure Hash Algorithm -->
@*<script src="js/jsSHA-master/src/sha.js"></script>*@
<script>
      window.config = {
          apiBaseUrl: '@System.Configuration.ConfigurationManager.AppSettings["toDoListAPIURL"]'
      };

</script>

<!-- Polyfill(s) for older browsers -->
<script src="node_modules/core-js/client/shim.min.js"></script>
<script src="node_modules/zone.js/dist/zone.js"></script>
<script src="node_modules/reflect-metadata/Reflect.js"></script>
<script src="node_modules/systemjs/dist/system.src.js"></script>

<!-- Configure SystemJS -->
<script src="systemjs.config.js"></script>

<script>
  System.import('app').catch(function(err){ console.error(err); });
</script>
</head>

<body>
<my-app>Loading AppComponent content here ...</my-app>
</body>
</html>

我该如何解决这些问题?

【问题讨论】:

  • 看来这里应该归咎于服务器。我访问了该页面,您每次都会得到不同的结果。您需要查看服务器是否也限制了它响应的请求数量或类似的东西。
  • 当我将 Angular 应用程序发布到 azure web 应用程序时,我仍然再次面临同样的问题。
  • 无法重现。请用您面临的新错误更新您的问题。
  • 我解决了我的错误,请看下面的答案。

标签: angular typescript visual-studio-2015 azure-web-app-service


【解决方案1】:

感谢 Teddy Sterne,当我从 web.config 中删除/评论以下代码行时。并将 Web 应用程序发布到 azure 中,它运行良好,没有任何错误。

 <!--<security>
  <dynamicIpSecurity denyAction="NotFound">        
    --><!--<denyByConcurrentRequests enabled="true" maxConcurrentRequests="2"/>--><!--      
    <denyByRequestRate enabled="true" maxRequests="20" requestIntervalInMilliseconds="60000" />
  </dynamicIpSecurity>
</security>-->

我认为是上面几行代码的问题,因为代码允许每分钟20个请求。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-09-30
    • 2020-01-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-11-01
    相关资源
    最近更新 更多