如何将Angular 2应用程序发布到Azure Web应用程序中?

时间:2017-02-27 13:56:14

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

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

有关我的问题的详情,请参阅下图。

enter image description here

但是我的应用程序正在我的本地计算机上工作,没有任何问题。这是我在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>

您能告诉我如何解决这些问题吗?

1 个答案:

答案 0 :(得分:0)

感谢Teddy Sterne,当我从 web.config 中删除/评论以下代码行时。并将网络应用程序发布到azure中,它的工作正常,没有任何错误。

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

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

相关问题