【问题标题】:Activation error occured while trying to get instance of type AttributeValidatorFactory, key ""尝试获取 AttributeValidatorFactory 类型的实例时发生激活错误,键“”
【发布时间】:2015-04-28 06:24:14
【问题描述】:

我在我的类库中使用 Visual Studio 2010 和 Enterprise Library Validation 5.0.505.0。但我面临像

这样的错误

尝试获取 AttributeValidatorFactory 类型的实例时发生激活错误,键“”

我在下一行遇到错误。

Validation.ValidateFromAttributes(obj);

其中 obj 是自定义对象。 我不知道如何解决这个问题。请帮忙 !! 提前致谢。

【问题讨论】:

    标签: asp.net validation enterprise-library


    【解决方案1】:

    我只是将 Microsoft EnterpriseLibrary 引用添加到我的网站。在我的情况下,DLL Microsoft.Practices.EnterpriseLibrary.Validation 位于以下路径中

    C:\Program Files (x86)\Microsoft Enterprise Library 5.0\Bin\Microsoft.Practices.EnterpriseLibrary.Validation.dll

    要找出路径,您应该按照该步骤操作。

    右键单击DLL>单击属性>这里有属性命名 路径

    还有一个非常小的技巧。

    右键单击 DLL > 单击属性 > 将 Copy Local 设置为 True(默认属性为 False

    现在,我清理我的解决方案并构建它并重新运行该解决方案。 应用程序运行正常,没有任何错误。宾果游戏!!!!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-02-23
      • 1970-01-01
      • 2015-03-04
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多