【问题标题】:ImageResizer library: plugins fail to load unless the project is rebuiltImageResizer 库:除非重建项目,否则插件无法加载
【发布时间】:2017-07-08 17:11:53
【问题描述】:

我在 ASP.NET MVC 4 项目中使用ImageResizer library(版本 3.2.4),带有以下插件:Watermark、MvcRoutingShim、DiskCache 和 SimpleFilters。

当我第一次在 Visual Studio 2012 中启动项目时一切正常。

但是在停止并重新启动项目2或3次后,插件无法加载,在诊断页面中确认:

(...)
Plugins(ConfigurationError):    Failed to load plugin by name "Watermark"
 Verify the plugin DLL is located in /bin, and that the name is spelled correctly. 

Plugins(ConfigurationError):    Failed to load plugin by name "MvcRoutingShim"
  Verify the plugin DLL is located in /bin, and that the name is spelled correctly. 
(...) etc.

DLL 文件存在于 \bin 文件夹中。

我可以通过在 Visual Studio 中执行项目的“清理”操作,然后“重建”来解决问题。

但是为什么插件在一段时间后无法加载?

【问题讨论】:

    标签: c# asp.net-mvc-4 imageresizer


    【解决方案1】:

    VS 很可能懒于构建代码中未引用的依赖项。

    尝试从代码而不是仅从 Web.config 引用 DLL,这可能会有所帮助。

    将以下代码放入Application_Start:

    new WatermarkPlugin().Install(Config.Current); 
    

    查看水印是否仍然在诊断页面上显示为丢失。

    【讨论】:

      猜你喜欢
      • 2013-11-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-07-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多