gpt4 book ai didi

asp.net - ImageResizer AzureReader2 插件 - 对调整大小请求的 404 响应

转载 作者:行者123 更新时间:2023-12-02 06:34:35 25 4
gpt4 key购买 nike

在专用服务器上使用 ImageResizer 和磁盘缓存插件多年后,我们正在逐步将我们的网站迁移到 Microsoft Azure。不幸的是,我在使用 ImageResizer AzureReader2 插件时遇到了问题。

我的测试镜像托管在 Azure 云存储容器中。 ImageResizer 插件已使用 NuGet 添加到新的空 MVC Web 项目中。如果我请求不带 QueryString 的图像,则 ImageResizer 的响应是 302 重定向到直接 blob URL。

例如

http://localhost:50505/azure/bhjrbbgljx.jpg -->
https://jetpress.blob.core.windows.net/media/bhjrbbgljx.jpg

但是,添加 QueryString 来执行调整大小会导致 404 未找到响应。

例如

http://local.host:50505/azure/bhjrbbgljx.jpg?width=200 --> 404 page

经过大量搜索后,我无法发现其他人也有类似的问题。问题Resizing an image using AzureReader2 results in 404不适用,因为我仍然通过 VS2013 在 IIS Express 上运行。

详细错误信息

Module
IIS Web Core

Notification
MapRequestHandler

Handler
StaticFile

Error Code
0x80070002

Requested URL
http://localhost:50505/azure/bhjrbbgljx.jpg?width=200

Physical Path
E:\projects\Websites.AzureMedia\JETPRESS.Web.Websites.AzureMedia\azure\bhjrbbgljx.jpg

Logon Method
Anonymous

Logon User
Anonymous

Request Tracing Directory
C:\Users\davidc\Documents\IISExpress\TraceLogFiles\JETPRESS.WEB.WEBSITES.AZUREMEDIA

web.config

<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="resizer" type="ImageResizer.ResizerSection" requirePermission="false" />
</configSections>
<appSettings>
<add key="webpages:Version" value="3.0.0.0" />
<add key="webpages:Enabled" value="false" />
<add key="ClientValidationEnabled" value="true" />
<add key="UnobtrusiveJavaScriptEnabled" value="true" />
</appSettings>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Optimization" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="1.1.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-5.2.0.0" newVersion="5.2.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.WindowsAzure.Storage" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.3.0.0" newVersion="4.3.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.WindowsAzure.Configuration" publicKeyToken="31bf3856ad364e35" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-2.0.0.0" newVersion="1.8.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<system.web>
<compilation debug="true" targetFramework="4.5" />
<httpRuntime targetFramework="4.5" />
<httpModules>
<add name="ImageResizingModule" type="ImageResizer.InterceptModule" />
</httpModules>
</system.web>
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<modules>
<add name="ImageResizingModule" type="ImageResizer.InterceptModule" />
</modules>
</system.webServer>
<resizer>
<diagnostics enableFor="Localhost" />
<plugins>
<add name="MvcRoutingShim" />
<add name="AzureReader2"
connectionString="[redacted]"
endpoint="https://jetpress.blob.core.windows.net/media/" />
</plugins>
</resizer>
</configuration>

resizer.debug

Image resizer diagnostic sheet      20/10/2014 14:38:41

2 Issues detected:

(Warning): To potentially see additional errors here, perform an image resize request.


(Warning): NoCache is only for development usage, and cannot scale to production use.
Add DiskCache or CloudFront for production use


You are using plugins from the Performance Edition: AzureReader2Plugin (Performance Edition)

Registered plugins:

ImageResizer.Plugins.Basic.DefaultEncoder
ImageResizer.Plugins.Basic.NoCache
ImageResizer.Plugins.Basic.ClientCache
ImageResizer.Plugins.Basic.Diagnostic
ImageResizer.Plugins.Basic.SizeLimiting
ImageResizer.Plugins.MvcRoutingShim.MvcRoutingShimPlugin
ImageResizer.Plugins.AzureReader2.AzureReader2Plugin

Configuration:

<resizer>
<diagnostics enableFor="Localhost" />
<plugins>
<add name="MvcRoutingShim" />
<add name="AzureReader2" connectionString="[redacted]" endpoint="https://jetpress.blob.core.windows.net/media/" />
</plugins>
</resizer>


Accepted querystring keys:

quality, format, thumbnail, maxwidth, maxheight, width, height, w, h, scale, stretch, crop, cropxunits, cropyunits, page, bgcolor, rotate, flip, sourceFlip, sFlip, sRotate, borderWidth, borderColor, paddingWidth, paddingColor, ignoreicc, frame, useresizingpipeline, cache, process, margin, anchor, dpi, mode, zoom,

Accepted file extensions:

bmp, gif, exif, png, tif, tiff, tff, jpg, jpeg, jpe, jif, jfif, jfi,

Environment information:

Running Microsoft-IIS/8.0 on Microsoft Windows NT 6.1.7601 Service Pack 1 and CLR 4.0.30319.18444
Trust level: Unrestricted
OS bitness: x86 !! Warning, running as 32-bit on a 64-bit OS(AMD64). This will limit ram usage !!
Executing assembly: C:\Program Files (x86)\IIS Express\iisexpress.exe
IntegratedPipeline: True

Loaded assemblies:

mscorlib Assembly: 4.0.0.0 File: 4.0.30319.18444 Info: 4.0.30319.18444
System.Web Assembly: 4.0.0.0 File: 4.0.30319.34237 Info: 4.0.30319.34237
System Assembly: 4.0.0.0 File: 4.0.30319.34238 Info: 4.0.30319.34238
System.Core Assembly: 4.0.0.0 File: 4.0.30319.18408 Info: 4.0.30319.18408
System.Web.ApplicationServices Assembly: 4.0.0.0 File: 4.0.30319.34237 Info: 4.0.30319.34237
System.Configuration Assembly: 4.0.0.0 File: 4.0.30319.18408 Info: 4.0.30319.18408
System.Xml Assembly: 4.0.0.0 File: 4.0.30319.34234 Info: 4.0.30319.34234
System.Runtime.Caching Assembly: 4.0.0.0 File: 4.0.30319.18408 Info: 4.0.30319.18408
Microsoft.Build.Utilities.v4.0 Assembly: 4.0.0.0 File: 4.0.30319.18408 Info: 4.0.30319.18408
Microsoft.JScript Assembly: 10.0.0.0 File: 11.0.50938.18408 Info: 11.0.50938.18408
System.Web.Mvc Assembly: 5.2.0.0 File: 5.2.20627.0 Info: 5.2.0-20627 (0adbfd47c58682f25b5ace9732ca9374ed1f9a89)
System.Web.WebPages.Deployment Assembly: 3.0.0.0 File: 3.0.20627.0 Info: 3.0.0-20627 (0adbfd47c58682f25b5ace9732ca9374ed1f9a89)
System.Web.WebPages.Deployment Assembly: 1.0.0.0 File: 1.0.20105.407
System.Web.WebPages Assembly: 3.0.0.0 File: 3.0.20627.0 Info: 3.0.0-20627 (0adbfd47c58682f25b5ace9732ca9374ed1f9a89)
Microsoft.VisualStudio.Web.PageInspector.Loader Assembly: 1.0.0.0 File: 12.3.50717.0
System.Web.WebPages.Deployment Assembly: 2.0.0.0 File: 2.0.20710.0
System.Web.WebPages.Razor Assembly: 3.0.0.0 File: 3.0.20627.0 Info: 3.0.0-20627 (0adbfd47c58682f25b5ace9732ca9374ed1f9a89)
Microsoft.VisualStudio.Web.PageInspector.Runtime Assembly: 12.3.0.0 File: 12.3.50717.0
Microsoft.Web.Infrastructure Assembly: 1.0.0.0 File: 1.0.20105.407
App_global.asax.tc0cm6e1 Assembly: 0.0.0.0
JETPRESS.Web.Websites.AzureMedia Assembly: 1.0.0.0 File: 1.0.0.0
System.ServiceModel.Activation Assembly: 4.0.0.0 File: 4.0.30319.18408 Info: 4.0.30319.18408
System.Web.Extensions Assembly: 4.0.0.0 File: 4.0.30319.34237 Info: 4.0.30319.34237
Microsoft.CSharp Assembly: 4.0.0.0 File: 4.0.30319.18408 Info: 4.0.30319.18408
System.Data Assembly: 4.0.0.0 File: 4.0.30319.18408 Info: 4.0.30319.18408
System.Web.Services Assembly: 4.0.0.0 File: 4.0.30319.18408 Info: 4.0.30319.18408
System.Drawing Assembly: 4.0.0.0 File: 4.0.30319.18408 Info: 4.0.30319.18408
System.EnterpriseServices Assembly: 4.0.0.0 File: 4.0.30319.18408 Info: 4.0.30319.18408
System.IdentityModel Assembly: 4.0.0.0 File: 4.0.30319.34234 Info: 4.0.30319.34234
System.Runtime.Serialization Assembly: 4.0.0.0 File: 4.0.30319.34234 Info: 4.0.30319.34234
System.ServiceModel Assembly: 4.0.0.0 File: 4.0.30319.34234 Info: 4.0.30319.34234
System.ServiceModel.Web Assembly: 4.0.0.0 File: 4.0.30319.18408 Info: 4.0.30319.18408
System.Activities Assembly: 4.0.0.0 File: 4.0.30319.34234 Info: 4.0.30319.34234
System.ServiceModel.Activities Assembly: 4.0.0.0 File: 4.0.30319.18408 Info: 4.0.30319.18408
System.WorkflowServices Assembly: 4.0.0.0 File: 4.0.30319.18408 Info: 4.0.30319.18408
System.Data.DataSetExtensions Assembly: 4.0.0.0 File: 4.0.30319.18408 Info: 4.0.30319.18408
System.Xml.Linq Assembly: 4.0.0.0 File: 4.0.30319.18408 Info: 4.0.30319.18408
System.ComponentModel.DataAnnotations Assembly: 4.0.0.0 File: 4.0.30319.18408 Info: 4.0.30319.18408
System.Web.DynamicData Assembly: 4.0.0.0 File: 4.0.30319.18408 Info: 4.0.30319.18408
ImageResizer Assembly: 3.4.3.103 File: 3.4.3.103 Info: 3-4-3 Commit: bf92fd7
ImageResizer.Mvc Assembly: 3.4.3.103 File: 3.4.3.103 Info: 3-4-3 Commit: bf92fd7
ImageResizer.Plugins.AzureReader2 Assembly: 3.4.3.103 File: 3.4.3.103 Info: 3-4-3 Commit: bf92fd7
Microsoft.Data.Edm Assembly: 5.6.2.0 File: 5.6.2.61936 Info: 5.6.2.61936
Microsoft.Data.OData Assembly: 5.6.2.0 File: 5.6.2.61936 Info: 5.6.2.61936
Microsoft.Data.Services.Client Assembly: 5.6.2.0 File: 5.6.2.61936 Info: 5.6.2.61936
Microsoft.WindowsAzure.Configuration Assembly: 1.8.0.0 File: 1.8.0.0
Microsoft.WindowsAzure.Storage Assembly: 4.3.0.0 File: 4.3.0.0
Newtonsoft.Json Assembly: 4.5.0.0 File: 5.0.8.16617
System.Spatial Assembly: 5.6.2.0 File: 5.6.2.61936 Info: 5.6.2.61936
System.Web.Helpers Assembly: 3.0.0.0 File: 3.0.20627.0 Info: 3.0.0-20627 (0adbfd47c58682f25b5ace9732ca9374ed1f9a89)
System.Web.Razor Assembly: 3.0.0.0 File: 3.0.20627.0 Info: 3.0.0-20627 (0adbfd47c58682f25b5ace9732ca9374ed1f9a89)
System.ServiceModel.Internals Assembly: 4.0.0.0 File: 4.0.30319.34234 Info: 4.0.30319.34234
System.Web.Routing Assembly: 4.0.0.0 File: 4.0.30319.18408 Info: 4.0.30319.18408
System.Web.Abstractions Assembly: 4.0.0.0 File: 4.0.30319.18408 Info: 4.0.30319.18408
SMDiagnostics Assembly: 4.0.0.0 File: 4.0.30319.34234 Info: 4.0.30319.34234
Microsoft.VisualStudio.Web.PageInspector.Tracing Assembly: 12.3.0.0 File: 12.3.50717.0
System.Web.Mobile Assembly: 4.0.0.0 File: 4.0.30319.34237 Info: 4.0.30319.34237
System.Web.RegularExpressions Assembly: 4.0.0.0 File: 4.0.30319.18408 Info: 4.0.30319.18408
System.Xaml.Hosting Assembly: 4.0.0.0 File: 4.0.30319.18408 Info: 4.0.30319.18408
System.Xaml Assembly: 4.0.0.0 File: 4.0.30319.18408 Info: 4.0.30319.18408

最佳答案

AzureReader2需要采用 /azure/container/blob

形式的路径

安装插件时,您可以通过 prefix="~/path" 属性更改 /azure 前缀。但是,为了从 URL 中删除容器名称,您将需要使用 URL 重写。

目前,您的端点和路径均无效。

endpoint="https://jetpress.blob.core.windows.net/media/"
路径:/azure/bhjrbbgljx.jpg

这些应该是

endpoint="https://jetpress.blob.core.windows.net/"
路径:/azure/media/bhjrbbgljx.jpg

重定向是通过串联的巧合实现的;我相信,这让您偏离了真正问题的轨道。

关于asp.net - ImageResizer AzureReader2 插件 - 对调整大小请求的 404 响应,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26469728/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com