【问题标题】:Could not load type 'ImageResizer.Util.BundleAttribute'无法加载类型“ImageResizer.Util.BundleAttribute”
【发布时间】:2016-04-07 03:17:15
【问题描述】:

1 月 1 日。我在我的托管网站上安装了 NopCommerce - 完成全新安装。 NopCommerce 使用通过 Visual Studio 中的 NuGet 管理的 ImageReszier 组件。

NopCommerce 从同一日期开始在我的本地安装上没有任何问题,但是当我尝试在我的托管网站上运行它时出现以下错误。

无法加载类型“ImageResizer.Util.BundleAttribute”

我使用 ImageResizer 版本:4.0.4.934

Stack Trace: 
[TypeLoadException: Could not load type 'ImageResizer.Util.BundleAttribute' from assembly 'ImageResizer, Version=4.0.0.0, Culture=neutral, PublicKeyToken=null'.]
   System.ModuleHandle.ResolveType(RuntimeModule module, Int32 typeToken, IntPtr* typeInstArgs, Int32 typeInstCount, IntPtr* methodInstArgs, Int32 methodInstCount, ObjectHandleOnStack type) +0
   System.ModuleHandle.ResolveTypeHandleInternal(RuntimeModule module, Int32 typeToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext) +152
   System.Reflection.RuntimeModule.ResolveType(Int32 metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments) +158
   System.Reflection.CustomAttribute.FilterCustomAttributeRecord(CustomAttributeRecord caRecord, MetadataImport scope, Assembly& lastAptcaOkAssembly, RuntimeModule decoratedModule, MetadataToken decoratedToken, RuntimeType attributeFilterType, Boolean mustBeInheritable, Object[] attributes, IList derivedAttributes, RuntimeType& attributeType, IRuntimeMethodInfo& ctor, Boolean& ctorHasParameters, Boolean& isVarArg) +91
   System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeModule decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType, Boolean mustBeInheritable, IList derivedAttributes, Boolean isDecoratedTargetSecurityTransparent) +438
   System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeAssembly assembly, RuntimeType caType) +103
   System.Reflection.RuntimeAssembly.GetCustomAttributes(Type attributeType, Boolean inherit) +64
   WebActivator.AssemblyExtensions.GetActivationAttributes(Assembly assembly) +126
   WebActivator.ActivationManager.RunActivationMethods() +220
   WebActivator.ActivationManager.RunPreStartMethods() +28
   WebActivator.ActivationManager.Run() +61

[InvalidOperationException: The pre-application start initialization method Run on type WebActivator.ActivationManager threw an exception with the following error message: Could not load type 'ImageResizer.Util.BundleAttribute' from assembly 'ImageResizer, Version=4.0.0.0, Culture=neutral, PublicKeyToken=null'..]
   System.Web.Compilation.BuildManager.InvokePreStartInitMethodsCore(ICollection`1 methods, Func`1 setHostingEnvironmentCultures) +613
   System.Web.Compilation.BuildManager.InvokePreStartInitMethods(ICollection`1 methods) +141
   System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath, Boolean& isRefAssemblyLoaded) +102
   System.Web.Compilation.BuildManager.ExecutePreAppStart() +157
   System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +531

[HttpException (0x80004005): The pre-application start initialization method Run on type WebActivator.ActivationManager threw an exception with the following error message: Could not load type 'ImageResizer.Util.BundleAttribute' from assembly 'ImageResizer, Version=4.0.0.0, Culture=neutral, PublicKeyToken=null'..]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9923092
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +90
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +261

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.6.114.0

【问题讨论】:

    标签: asp.net-mvc nopcommerce imageresizer


    【解决方案1】:

    问题解决了。我最终删除了所有内容并再次进行了全新安装。现在它正在工作。

    【讨论】:

    • 嘿,我也遇到了同样的问题,请告诉我解决问题的具体步骤,我已经尝试过清理,但没有成功。
    【解决方案2】:

    您可能下载了错误的插件 S3Reader 或 AzureReader。 如果您使用的是 S3,请将 nuget 包 ImageResizer.Plugins.S3Reader 替换为 ImageResizer.Plugins.S3Reader2

    【讨论】:

      【解决方案3】:

      我遇到了同样的问题,在删除 bin 文件夹中的所有内容并重建解决方案后,它对我有用!!

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2012-08-14
        • 2015-08-28
        • 2016-03-05
        • 2014-08-09
        • 2015-04-16
        • 2010-09-08
        • 2017-04-13
        • 2014-01-03
        相关资源
        最近更新 更多