在IE11上发布后将无法加载Angular应用 [英] Angular App Won't Load After Publishing On IE11

查看:72
本文介绍了在IE11上发布后将无法加载Angular应用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在使用ASP.NET后端在Angular中开发一个应用程序.我已将项目配置为在IE11中本地正常运行(更新polyfills,浏览器列表,并添加ES5 TsConfig文件),但是当我通过IIS将其发布到服务器时,该页面将无法加载,并停留在加载"状态..."

为了测试发布,我尝试将默认的Angular/ASP.NET应用发布为相同的结果.

控制台显示四个错误:

  SCRIPT1002:语法错误runtime.458556a34b891ea32398.js(1,1)SCRIPT1002:语法错误polyfills-es5.7119ad0e4b3aeae98a0b.js(1,1)SCRIPT1002:语法错误polyfills.4efda4a4618e08b621be.js(1,1)SCRIPT1002:语法错误main.59969322f93fb24d6bee.js(1,1) 

polyfills.ts

  import'classlist.js';导入'web-animations-js';导入'zone.js/dist/zone'; 

web.config

 <?xml version ="1.0"encoding ="utf-8"?<配置>< system.webServer>< rewrite><规则>< rule name ="Angular Routes"stopProcessing ="true"< match url =.*"/>< conditions logicalGrouping ="MatchAll">< add input =" {REQUEST_FILENAME}"matchType ="IsFile";否定=真"/>< add input =" {REQUEST_FILENAME}"matchType ="IsDirectory";否定=真"/>< add input =" {REQUEST_URI}"pattern ="^/(api)"否定=真"/></conditions>< action type =重写"url ="/"/></rule></rules></rewrite>< defaultDocument enabled ="true"><文件>< add value =" ClientApp/dist/index.html"/></files></defaultDocument></system.webServer></configuration> 

解决方案

感谢@ Deepak-MSFT的答案,原来我没有 解决方案

Thanks @Deepak-MSFT for the answer, turns out I didn't have the .NET Hosting Bundle installed on the host machine. Once I installed that, the website displayed as it was supposed to -- barring a couple issues not related to what I'm talking about here.

For those curious, I was having issues with database connection string, I found another project being hosted on the server and modified its connection string: data source=[database];initial catalog=[table];persist security info=True;user id=[user id];password=[password];MultipleActiveResultSets=True;App=EntityFramework

I also removed the web.config file I'd created, as it would probably get in the way of the one generated during publishing.

这篇关于在IE11上发布后将无法加载Angular应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆