【问题标题】:414 (request-uri too long) in ASP .NET MVC only on devices - 51 Degrees Device Detection?ASP .NET MVC 中的 414(请求 uri 太长)仅在设备上 - 51 度设备检测?
【发布时间】:2015-02-12 11:39:32
【问题描述】:

我依靠@Request.Browser.IsMobileDevice 来区分访问 ASP .NET MVC 网站的访问者。

我正在使用51 Degrees 库。但是,当从移动设备浏览某些图像时,出现错误 414 (request-uri too long)。在 PC 上,这不会发生,仅在移动设备上发生。

堆栈显示PathTooLongException 在:

   à System.IO.PathHelper.GetFullPathName()
   à System.IO.Path.NormalizePath(String path, Boolean fullCheck, Int32 maxPathLength, Boolean expandShortPaths)
   à System.IO.Path.GetFullPathInternal(String path)
   à System.Security.Util.StringExpressionSet.CanonicalizePath(String path, Boolean needFullPath)
   à System.Security.Util.StringExpressionSet.CreateListFromExpressions(String[] str, Boolean needFullPath)
   à System.Security.Permissions.FileIOPermission.AddPathList(FileIOPermissionAccess access, AccessControlActions control, String[] pathListOrig, Boolean checkForDuplicates, Boolean needFullPath, Boolean copyPathList)
   à System.Security.Permissions.FileIOPermission..ctor(FileIOPermissionAccess access, String path)
   à System.Web.InternalSecurityPermissions.PathDiscovery(String path)
   à System.Web.HttpRequest.MapPath(VirtualPath virtualPath, VirtualPath baseVirtualDir, Boolean allowCrossAppMapping)
   à System.Web.HttpServerUtility.MapPath(String path)
   à FiftyOne.Foundation.Mobile.Detection.Feature.ImageOptimiser.OptimisedImageResponse(HttpContext context)
   à FiftyOne.Foundation.Mobile.Detection.DetectorModule.OnPostAuthorizeRequest(Object sender, EventArgs e)
   à System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   à System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

似乎FiftyOne 在此堆栈中。当我卸载 51Degrees 时,它会恢复工作。但是我需要 51Degrees 来保持IsMobileDevice 与当前设备兼容。

我缺少任何参数吗? 51度是版本.NET 3.1.9.3

【问题讨论】:

  • 似乎ImageOptimiser.OptimisedImageResponse 正在尝试将虚拟路径映射到物理磁盘路径。完整文件路径的最大长度仅为 260 个字符。我的猜测是该库已经设法创建了一条系统无法处理的路径。
  • 我刚刚遇到了这个问题。你搞定了吗?

标签: asp.net-mvc mobile 51degrees


【解决方案1】:

几天前我遇到了同样的问题。多年来,我们一直在使用 51Degrees 解决方案,但现在在移动设备上遇到了 414 问题。

我最终使用了“The official WURFL API for .NET”。易于实施并提供我们需要从 WURFL 数据存储库中读取的所有功能。现在我不再收到 414 错误。

【讨论】:

    【解决方案2】:

    如果您发现自己处于类似情况,您可以:

    1. 转到 51Degrees.config 文件
    2. 打开它
    3. 向下滚动直到找到imageOptimisation部分
    4. 启用设置为false
    5. 保存并重新启动应用程序

    解决 414 问题的另一种方法。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-06-02
      • 1970-01-01
      • 1970-01-01
      • 2019-12-11
      • 2019-11-27
      • 1970-01-01
      • 1970-01-01
      • 2013-10-31
      相关资源
      最近更新 更多