【发布时间】:2012-02-01 03:44:40
【问题描述】:
我正在处理程序中动态生成我的缓存清单,将内容类型设置为“text/cache-manifest”。 但是,当我在 Chrome 中加载我的缓存页面时,我在 Chrome 的控制台中收到以下错误(注意括号中的空字符串),并且文件永远不会更新:
Application Cache Error event: Invalid manifest mime type () http://localhost:4010/WebClient/CacheManifest.ashx
这在近一年前运行良好,但突然开始发生。
有什么想法吗?
这是 CacheManifest.ashx 的代码隐藏:
public class CacheManifest : IHttpHandler
{
public bool IsReusable
{
get
{
return true;
}
}
public void ProcessRequest(HttpContext context)
{
HttpResponse response = context.Response;
response.Clear();
response.ContentType = "text/cache-manifest";
StringBuilder output = new StringBuilder();
output.AppendLine("CACHE MANIFEST");
output.AppendLine();
output.AppendLine("CACHE:");
// here's the code that loads files from disk and adds to manifest.
// allow online resources
output.AppendLine("NETWORK:");
output.AppendLine("*");
output.AppendFormat("# hash: {0}", GetContentHash());
response.Write(output.ToString());
}
}
【问题讨论】: