Chrome:资源解释为文档,但使用MIME类型image / gif进行传输

时间:2016-04-18 09:24:58

标签: google-chrome asp.net-mvc-5

我正在使用ASP.NET MVC 5开发REST服务..这是一个简化的代码:

[HttpGet]
[Route("api/v1/qrcode")]
[OutputCache(NoStore = true, Location = OutputCacheLocation.None)]
public FileContentResult GenerateNewQrCode(int height = 200, int width = 200)
{
    byte[] qrcode  = ... some qrcode generation logic here ...

    return new FileContentResult(qrCode.ToArray(), "image/gif");
}

您可以在此处试用http://13.76.95.11:81/api/v1/qrcode

但谷歌浏览器会在控制台中显示Resource interpreted as Document but transferred with MIME type image/gif ...

enter image description here

可能是什么问题?

1 个答案:

答案 0 :(得分:0)

没关系......只有当我直接在地址栏中输入图片网址时,才会显示此警告...

如果通过<img src="....属性引用图片网址,则不会显示任何警告(无论如何这都是预期用途)。

因此,我猜Chrome会假设我们在网址栏中输入的内容属于Document类型,但会接收图片。