AppCache - 明显错误 (4)
AppCache - manifest error (4)
我很难调试为什么 appcache 对我不起作用。最近 chrome 我遇到了以下错误:
Creating Application Cache with manifest http://localhost/BEST/Home/Manifest
(index):1 Application Cache Checking event
(index):1 Application Cache Error event: Manifest fetch failed (4) http://localhost/BEST/Home/Manifest
更具体(来自 onerror 方法):
ApplicationCacheErrorEvent {
message: "Manifest fetch failed (4) http://localhost/BEST/Home/Manifest",
status: 4294967295,
url: "http://localhost/BEST/Home/Manifest",
reason: "manifest",
clipboardData: undefined…}
bubbles: false
cancelBubble: false
cancelable: false
clipboardData: undefined
currentTarget: ApplicationCache
defaultPrevented: false
eventPhase: 0
message: "Manifest fetch failed (4) http://localhost/BEST/Home/Manifest"
path: NodeList[0]
reason: "manifest"
returnValue: true
srcElement: ApplicationCache
oncached: null
onchecking: null
ondownloading: null
onerror: function (a,b,c)
onnoupdate: null
onobsolete: null
onprogress: null
onupdateready: null
status: 0
__proto__: ApplicationCache
status: 4294967295
target: ApplicationCache
oncached: null
onchecking: null
ondownloading: null
onerror: function (a,b,c)
onnoupdate: null
onobsolete: null
onprogress: null
onupdateready: nullstatus: 0
__proto__: ApplicationCache
timeStamp: 1425021666357
type: "error"
url: "http://localhost/BEST/Home/Manifest"
__proto__: ApplicationCacheErrorEvent
我的清单很简单:
CACHE MANIFEST
CACHE:
Content/DataTables-1.10.3/language/polish.json
NETWORK:
*
甚至 manifesto 也没有帮助
清单文件由 ASP.NET MVC 操作提供,但我认为无关紧要。
以防万一代码:
public ActionResult Manifest()
{
//Response.Cache.SetCacheability(System.Web.HttpCacheability.NoCache);
var text = System.IO.File.ReadAllText(HttpContext.Server.MapPath("../a.appcache"));
return new ContentResult()
{
ContentType = "text/cache-manifest",
Content = text,
ContentEncoding = System.Text.Encoding.UTF8
};
}
[编辑]
在 Win 的 Safari 上我得到了
Application Cache manifest could not be fetched, because a redirection was attempted.
也许这里有问题?
这是我从附加到 chrome 的提琴手那里得到的:
我明白了,有一个 302,但这会是问题所在吗?
而且我不知道如何将它更改为 200。
[edit2]
我在 Manifest 操作中手动设置了状态代码,它开始工作了:
public ActionResult Manifest()
{
//Response.Cache.SetCacheability(System.Web.HttpCacheability.NoCache);
var text = System.IO.File.ReadAllText(HttpContext.Server.MapPath("../BEST.appcache"));
Response.StatusCode = 200;
return new ContentResult()
{
ContentType = "text/cache-manifest",
Content = text,
ContentEncoding = System.Text.Encoding.UTF8
};
}
但这只是暂时的...经过几次测试,现在我得到了不同的错误。之所以这次设置为signature,而不是manifest:
Application Cache Error event: Failed to parse manifest http://localhost/BEST/Home/Manifest
(index):252
ApplicationCacheErrorEvent {
message: "Failed to parse manifest http://localhost/BEST/Home/Manifest",
status: 0,
url: "",
reason: "signature",
clipboardData: undefined…}
bubbles: false
cancelBubble: false
cancelable: false
clipboardData: undefined
currentTarget: ApplicationCache
defaultPrevented: false
eventPhase: 0
message: "Failed to parse manifest http://localhost/BEST/Home/Manifest"
path: NodeList[0]
reason: "signature"
returnValue: true
srcElement: ApplicationCache
status: 0
target: ApplicationCache
timeStamp: 1425025030583
type: "error"
url: ""
__proto__: ApplicationCacheErrorEvent
解决方法是将状态码设置为200,no-storeheader无法定义。
我很难调试为什么 appcache 对我不起作用。最近 chrome 我遇到了以下错误:
Creating Application Cache with manifest http://localhost/BEST/Home/Manifest
(index):1 Application Cache Checking event
(index):1 Application Cache Error event: Manifest fetch failed (4) http://localhost/BEST/Home/Manifest
更具体(来自 onerror 方法):
ApplicationCacheErrorEvent {
message: "Manifest fetch failed (4) http://localhost/BEST/Home/Manifest",
status: 4294967295,
url: "http://localhost/BEST/Home/Manifest",
reason: "manifest",
clipboardData: undefined…}
bubbles: false
cancelBubble: false
cancelable: false
clipboardData: undefined
currentTarget: ApplicationCache
defaultPrevented: false
eventPhase: 0
message: "Manifest fetch failed (4) http://localhost/BEST/Home/Manifest"
path: NodeList[0]
reason: "manifest"
returnValue: true
srcElement: ApplicationCache
oncached: null
onchecking: null
ondownloading: null
onerror: function (a,b,c)
onnoupdate: null
onobsolete: null
onprogress: null
onupdateready: null
status: 0
__proto__: ApplicationCache
status: 4294967295
target: ApplicationCache
oncached: null
onchecking: null
ondownloading: null
onerror: function (a,b,c)
onnoupdate: null
onobsolete: null
onprogress: null
onupdateready: nullstatus: 0
__proto__: ApplicationCache
timeStamp: 1425021666357
type: "error"
url: "http://localhost/BEST/Home/Manifest"
__proto__: ApplicationCacheErrorEvent
我的清单很简单:
CACHE MANIFEST
CACHE:
Content/DataTables-1.10.3/language/polish.json
NETWORK:
*
甚至 manifesto 也没有帮助
清单文件由 ASP.NET MVC 操作提供,但我认为无关紧要。 以防万一代码:
public ActionResult Manifest()
{
//Response.Cache.SetCacheability(System.Web.HttpCacheability.NoCache);
var text = System.IO.File.ReadAllText(HttpContext.Server.MapPath("../a.appcache"));
return new ContentResult()
{
ContentType = "text/cache-manifest",
Content = text,
ContentEncoding = System.Text.Encoding.UTF8
};
}
[编辑]
在 Win 的 Safari 上我得到了
Application Cache manifest could not be fetched, because a redirection was attempted.
也许这里有问题?
这是我从附加到 chrome 的提琴手那里得到的:
我明白了,有一个 302,但这会是问题所在吗? 而且我不知道如何将它更改为 200。
[edit2]
我在 Manifest 操作中手动设置了状态代码,它开始工作了:
public ActionResult Manifest()
{
//Response.Cache.SetCacheability(System.Web.HttpCacheability.NoCache);
var text = System.IO.File.ReadAllText(HttpContext.Server.MapPath("../BEST.appcache"));
Response.StatusCode = 200;
return new ContentResult()
{
ContentType = "text/cache-manifest",
Content = text,
ContentEncoding = System.Text.Encoding.UTF8
};
}
但这只是暂时的...经过几次测试,现在我得到了不同的错误。之所以这次设置为signature,而不是manifest:
Application Cache Error event: Failed to parse manifest http://localhost/BEST/Home/Manifest
(index):252
ApplicationCacheErrorEvent {
message: "Failed to parse manifest http://localhost/BEST/Home/Manifest",
status: 0,
url: "",
reason: "signature",
clipboardData: undefined…}
bubbles: false
cancelBubble: false
cancelable: false
clipboardData: undefined
currentTarget: ApplicationCache
defaultPrevented: false
eventPhase: 0
message: "Failed to parse manifest http://localhost/BEST/Home/Manifest"
path: NodeList[0]
reason: "signature"
returnValue: true
srcElement: ApplicationCache
status: 0
target: ApplicationCache
timeStamp: 1425025030583
type: "error"
url: ""
__proto__: ApplicationCacheErrorEvent
解决方法是将状态码设置为200,no-storeheader无法定义。