いくつかの画像を提供するIHttpHandler
ASP.NET があります。ハンドラーは、次の方法で ETAG を設定します。
context.Response.AddFileDependency(filename);
context.Response.Cache.SetLastModifiedFromFileDependencies();
context.Response.Cache.SetETagFromFileDependencies();
context.Response.Cache.SetCacheability(HttpCacheability.Public);
context.Response.Cache.SetMaxAge(new TimeSpan(999,0,0,0));
context.Response.Cache.SetSlidingExpiration(true);
context.Response.Cache.SetValidUntilExpires(true);
context.Response.Cache.VaryByParams["*"] = true;
byte[] buffer = File.ReadAllBytes(filename);
context.Response.ContentType = MimeMapping.GetMimeMapping(mi.Mi_filename);
context.Response.StatusCode = 200;
context.Response.BinaryWrite(buffer);
System.Web.HttpException
IIS7 で次のような例外が発生することがあります。
依存関係から etag を生成できません。依存関係の 1 つで一意の ID を生成できませんでした。
しかし、問題を再現することはできません (ASP.NET 内部テスト Web サーバーでこれをテストできないことはわかっています)。なぜこれが起こるのか、これを防ぐために何ができるのか、誰にも手がかりがありますか?