IIS7 的 AppCache mime 类型
我们正在托管一些 HTML5 游戏,它们利用 offline.appcache
功能让游戏缓存得更好。
然而,为了提供 .appcache
类型,我必须将 mime 类型添加到服务器 (IIS7),这样它就不会出现 404。当我这样做时,它拒绝提供任何图像或 CSS 文件!当我请求 CSS 或图像文件时发送到浏览器的错误是:
The page cannot be displayed because an internal server error has occurred.
我添加的扩展名是 appcache
,MIME 类型为 text/cache-manifest
。
知道为什么会导致这种行为吗?
We're hosting a couple of HTML5 games that utilise the offline.appcache
feature letting games cache a lot better.
To serve the .appcache
type however, I had to add the mime type to the server (IIS7) so it wouldn't 404. When I do, it refuses to serve any images or CSS files! The error sent to the browser when I request a CSS or image file is:
The page cannot be displayed because an internal server error has occurred.
The extension I am adding is appcache
with the MIME type text/cache-manifest
.
Any ideas why it's causing this behaviour?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
终于弄清楚了,我在服务器级别而不是站点级别添加了 mime 类型。其中一个站点已经定义了该 mime 类型。这引起了冲突。但奇怪的是,具有双重定义的网站很好,其他网站却失败了。
Finally figured it out, I added the mime type on server level not site level. One of the sites already had that mime type defined. Which caused a conflict. But bizarrely the site with the dual definition was fine, it was the other sites that failed.
添加 .appcache 时我遇到了类似的问题。所有 .js 和 .css 文件请求都会从 IIS 响应错误。我意识到这是因为我没有指定 NETWORK: 部分。
我的工作 .appcache 现在强制刷新所有文件并且不会导致错误:
I ran into a similar issue when adding the .appcache. All .js and .css file requests responded with an error from IIS. I realized it was because I had not specified a NETWORK: section.
My working .appcache now forces all files to be refreshed and doesn't cause errors: