【问题标题】:ImageResizer.AzureReader2 not working with QUERYSTRING (Azure Web App)ImageResizer.AzureReader2 不适用于 QUERYSTRING(Azure Web 应用程序)
【发布时间】:2015-05-24 05:37:05
【问题描述】:

我正在尝试迁移到已成功运行 ImageResizer 的 ASP.NET 应用程序 Azure。我将 ~/Photos 文件加载到块块上,并安装了 AzureReader2 插件。

然后一个错误阻止应用程序加载:

Unable to load Microsoft.WindowsAzure.CloudConfigurationManager from assembly  
Microsoft.WindowsAzure.Configuration, Version=3.0.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35.

我下载了 AzureReader2 源代码并重新编译它,用 CloudStorageAccount.Parse() 替换缺少的 CloudConfigurationManager(),这似乎解决了问题。

我用修改后的插件替换了对 3.4.3 AzureReader2 插件的引用,应用程序运行。

现在 AzureReader2 似乎拦截了图像请求并重定向到指定的端点,只要没有指定 QUERYSTRING。

如果我指定任何查询字符串参数,我会得到 404-Not Found。

http://localhost:1905/Photos/2025/15/29/qcu0tks1.jpg?width=100

如果我省略查询字符串,它会重定向到 Azure 存储 url 并显示图像: http://127.0.0.1:10000/devstoreaccount1/pracasar/Photos/2025/15/29/qcu0tks1.jpg

如果我将查询字符串参数应用到不同的文件夹(比如 ~/images/logo.jpg),它就可以正常工作。所以这似乎确实是 AzureReader2 的一个问题。

有什么想法吗?

【问题讨论】:

  • 404 可能是由于缺少 DLL 而不是缺少图像引起的。你能用 v4 重现这个问题吗?
  • Version 4-preview1 给了我同样的 Microsoft.WindowsAzure.CloudConfigurationManager() 错误。我发现 404-Not Found 与我在路径上指定 Azure 容器的方式有关(请参阅下面的答案)。但我设法让它与修补的 3.4.3-AzureReader2 一起工作。所以最好在 4.0 上解决这个问题。

标签: asp.net azure imageresizer


【解决方案1】:

至于 404-Not Found 错误,问题在于如何指定容器名称。

我正在将容器名称添加到端点。这导致了描述的不稳定行为(404-指定查询字符串时未找到)。

**Generates: 404-Not Found when querystring is specified**
<add name="AzureReader2"
       endpoint="http://mystorage.blob.core.windows.net/mycontainer" prefix="~/Photos" /> 

虽然生成的 URL 有效,但当指定查询字符串时,它会生成 404-Not Found。

容器名称应作为资源名称的前缀添加。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-03-24
    • 1970-01-01
    • 2016-05-22
    • 2018-07-29
    • 1970-01-01
    • 1970-01-01
    • 2015-09-05
    相关资源
    最近更新 更多