当使用Cassini (VisualStudio2015Version14,update 3)调试.NET 4.6.1 web应用程序时,我在使用TypeScript的页面上得到了此错误:
Refused to execute script from 'http://localhost:53049/Scripts/app.ts' because its MIME type ('video/vnd.dlna.mpeg-tts') is not executable.这些错误发生在Chrome版本55.0.2883.87m(64位),而不是IE.这个错误似乎是在上一次Chrome更新之后出现的。
我理解Visual将.js文件映射到.ts文件,并且可以在Cassini上运行时调试.ts文件。
所以,看来我需要
1)让Chrome执行.ts文件
或
2)让Visual停止尝试让Chrome执行.ts文件,只需使用转置的.js文件即可。
我该怎么做呢?
以下是我的TypeScript构建设置。切换“生成源映射”似乎没有什么区别。

发布于 2017-01-16 22:17:05
确保Cassini以正确的mime类型为.ts文件提供服务。可以将以下内容添加到web.config文件中以强制执行:
<system.webServer>
<staticContent>
<remove fileExtension=".ts" />
<mimeMap fileExtension=".ts" mimeType="application/x-typescript" />
</staticContent>
</system.webServer>https://stackoverflow.com/questions/41655863
复制相似问题