[英]CSS and JS files having junk characters after publishing Asp.net website
I am publishing an asp.net website and when I try to run it, the CSS
and the JS
files are not loading correctly. 我正在发布一个asp.net网站,当我尝试运行它时, CSS
和JS
文件无法正确加载。 When I open the Chrome debugger tools , all the JS files are giving the following error 当我打开Chrome调试器工具时 ,所有JS文件都出现以下错误
"Uncaught SyntaxError: Unexpected token ILLEGAL" “未捕获的SyntaxError:意外的令牌非法”
and when I view the js files from the developer tools, they contain only junk characters. 当我从开发人员工具查看js文件时,它们仅包含垃圾字符。 The thing is when I view the files on the file system, they appear to be fine but when I view them from the developer tools or from a browser eg http://localhost/MyApp/jquery.js , I see only junk characters 问题是,当我在文件系统上查看文件时,它们似乎很好,但是当我从开发人员工具或浏览器(例如http://localhost/MyApp/jquery.js)查看它们时,我只能看到垃圾字符
I've been trying to find out what's wrong but this error keeps coming. 我一直在尝试找出问题所在,但此错误不断出现。 it was working before and all of a sudden I am getting this. 它之前一直在工作,突然间我得到了这个。
It turns out that there was a key in my web.config
that was compressing the javascript files on the fly. 事实证明,我的web.config
中有一个密钥正在动态压缩javascript文件。
I had the GZip compression key in my config file which was causing this issue. 我的配置文件中包含GZip压缩密钥,这是导致此问题的原因。 here's the key 这是关键
<add name="Headers_GZipOutput" type="Headers_GZipOutput"/>
I commented this and it started working. 我对此发表了评论,它开始起作用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.