不断收到旧版本,甚至更改默认服务版本在Azure BLOB(序设置内容部署标头)后 [英] Keep getting old version, even after changing the Default Service Version on azure blob (inorder to set the content disposition header)

查看:219
本文介绍了不断收到旧版本,甚至更改默认服务版本在Azure BLOB(序设置内容部署标头)后的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

背景:

我试图强制浏览器响应下载一个图像到按钮(或链接)单击,而不是显示它内联。我需要这个工作的跨浏览器的,所以HTML5属性是不够的。

I'm trying to force the browser to download an image in response to a button (or link) click, instead of showing it inline. I need this to work cross browsers, so HTML5 attributes aren't enough.

图片存储在一个BLOB(Azure存储服务)。

The Image is stored in a blob (azure storage services).

我的尝试:


  1. 要在DefaultServiceVersion设为2013-08-15所以contentDisposition会工作。 (例如,从这里 Azure存储API ContentDisposition ):

var cloudStorageAccount = new CloudStorageAccount(new StorageCredentials("accountname", "accountkey"), false);
var serviceProperties = cloudStorageAccount.CreateCloudBlobClient().GetServiceProperties();
serviceProperties.DefaultServiceVersion = "2013-08-15";
cloudStorageAccount.CreateCloudBlobClient().SetServiceProperties(serviceProperties);


  • 要设置内容处置财产(例如,从的 http://www.tuicool.com/articles/AFbmY3 ):

    blob.Properties.ContentDisposition = "attachment; filename=" + downloadName;
    


  • 要从链接click\window.open(IMAGE_URL)调用图像\ window.location的= IMAGE_URL。
    在后台提琴手

  • To Call the image from a link click\window.open(image_url)\window.location = image_url. With fiddler in the background.

    问题:
    中的图像是由1E所示为在线图像。检查的小提琴手,看到:

    The problem: The image is shown by IE as an in-line image. Checking on fiddler and see that:


    1. 该contentDisposition不会在响应头存在

    1. The contentDisposition doesn't exist in the response header.

    的x毫秒的版本中的响应是不是一个我设置为默认的。我不断收到旧版本2009-09-19。

    The x-ms-version in the response is not the one I set as the default one. I'm Keep getting the old version 2009-09-19.

    所以我也试图直接生成请求从小提琴手,在请求。这样做的工作,我得到我期待的回应,与contentDisposition财产和正确的X-MS-版本(我添加到请求之一 - 2013-08-15)。

    So I also tried to generate the request directly from fiddler, with the x-ms-version specified in the request header. This does work and I'm getting the response I'm expecting for, with the contentDisposition property and the right x-ms-version (the one I added to the request - 2013-08-15).

    据我所知,这个问题是默认的服务版本,当我检查(在调试)的DefaultServiceVersion财产我看到正确的价值(2013-08-15)的值,但仍响应包含旧值

    I understand that the problem is with the default service version and when i check (while debugging) the value of the DefaultServiceVersion property I do see the right value(2013-08-15), but still the response contains the old value.

    我不能X-MS-版本添加到报头,同时产生由一个链路请求(或从window.open)和我真的不明白,为什么我添加的默认值是行不通的。

    I can't add x-ms-version to the header while generating the request from a link (or from window.open) and I don't really understand why the default value I added isn't working.

    在事先的任何帮助或建议如何解决这个问题。谢谢

    Thanks in advance for any help or suggestion how to solve this issue.

    推荐答案

    我想我知道发生了什么。请看看这个链接: http://msdn.microsoft.com/en -us /库/天蓝色/ dd894041.aspx (转到节标题为:请求可以通过匿名访问其内容)

    I think I know what's happening. Please check out this link: http://msdn.microsoft.com/en-us/library/azure/dd894041.aspx (Go to the section titled: Requests Via Anonymous Access which reads)

    如果到Blob服务的请求没有指定X-MS-版本
    标题,该服务的默认版本一直没有使用$ b $设置b将Blob服务属性,那么一滴
    服务的最早版本是用来处理请求。 然而,如果容器是
    公开了集集装箱ACL操作使用的版本
    2009-09-19或履行新,则请求使用版本
    2009-09处理-19

    If a request to the Blob service does not specify the x-ms-version header, and the default version for the service has not been set using Set Blob Service Properties, then the earliest version of the Blob service is used to process the request. However, if the container was made public with a Set Container ACL operation performed using version 2009-09-19 or newer, then the request is processed using version 2009-09-19.

    最有可能你所创建的容器或改变它的ACL更改服务版本之前,因此,如果没有服务。版本提供,它使用的是旧版本的

    Most likely you created the container or changed it's ACL before changing the service version and thus if no service version is provided, it is using the older version.

    您可以尝试两件事情:


    1. 创建与ACL公众一个新的blob容器,并尝试从那里下载一个blob。由于容器与新的服务版本创建的,你应该不会遇到这个错误。

    2. 改变容器ACL来私人,然后改变回公开。由于操作是现在图书馆的最新版本(我假设)进行下载BLOB时,你应该不会遇到这个错误。

    1. Create a new blob container with ACL as public and try downloading a blob from there. Since the container is created with new service version, you should not encounter this error.
    2. Change the container ACL to Private and then change it back to Public. Since the operation is now performed with the latest version of library (I'm assuming), you should not encounter this error when downloading blob.

    这篇关于不断收到旧版本,甚至更改默认服务版本在Azure BLOB(序设置内容部署标头)后的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

  • 查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆