.net - 刚刚通过 NuGet 更新了 ImageResizer,无法运行应用程序,因为它找不到 BundleAttribute

标签 .net azure azure-web-app-service imageresizer

我只是想更新 Azure 存储,但这意味着我需要更新 ImageResizer AzureReader 并更新应用程序以使用 .Net 4.5.2(Azure 站点设置为 .Net 4.6)。现在我已经拥有了最新版本的所有内容;我已经清理并重建了该应用程序。它在本地运行良好,但是当我将其发布到 Azure 时,出现以下错误。我无法加载诊断页面。

Server Error in '/' Application.

Could not load type 'ImageResizer.Util.BundleAttribute' from assembly 'ImageResizer, Version=4.0.0.0, Culture=neutral, PublicKeyToken=null'.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.TypeLoadException: Could not load type 'ImageResizer.Util.BundleAttribute' from assembly 'ImageResizer, Version=4.0.0.0, Culture=neutral, PublicKeyToken=null'.

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

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) +403
   System.ModuleHandle.ResolveTypeHandle(Int32 typeToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext) +20
   System.Reflection.RuntimeModule.ResolveType(Int32 metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments) +315
   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) +188
   System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeModule decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType, Boolean mustBeInheritable, IList derivedAttributes, Boolean isDecoratedTargetSecurityTransparent) +1184
   System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeAssembly assembly, RuntimeType caType) +146
   Owin.Loader.DefaultLoader.SearchForStartupAttribute(String friendlyName, IList`1 errors, Boolean& conflict) +180
   Owin.Loader.DefaultLoader.LoadImplementation(String startupName, IList`1 errorDetails) +184
   Microsoft.Owin.Host.SystemWeb.OwinBuilder.GetAppStartup() +138
   Microsoft.Owin.Host.SystemWeb.OwinHttpModule.InitializeBlueprint() +38
   System.Threading.LazyInitializer.EnsureInitializedCore(T& target, Boolean& initialized, Object& syncLock, Func`1 valueFactory) +242
   Microsoft.Owin.Host.SystemWeb.OwinHttpModule.Init(HttpApplication context) +108
   System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +642
   System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +353
   System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +402
   System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +447

[HttpException (0x80004005): 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) +684
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +121
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +771

我所有的 ImageResizer 插件的版本都是 4.0.4。

有什么想法吗?

最佳答案

您正在将 v3 ImageResizer 程序集与 v4 ImageResizer 程序集混合。删除所有 ImageResizer* dll 文件并重新安装一个版本。

关于.net - 刚刚通过 NuGet 更新了 ImageResizer,无法运行应用程序,因为它找不到 BundleAttribute,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34279041/

相关文章:

c# - linq匿名方法中的局部变量范围(闭包)

php - soap 信封是如何生成的,为什么 .NET 和 php 客户端会生成/接收不同的 soap 信封?

json - Arduino API 和 Json 向 azure 发送信息

windows-phone-7 - 在 Azure 上运行应用程序并保护注册

azure - 从私有(private) docker 镜像在 azure 上运行单个容器应用程序返回 : :( Application Error

asp.net-core - 使用 Kudu 构建服务部署 asp.net 核心应用程序时出现 UnauthorizedAccessException

azure - 允许冒号(:) in URL on Azure Web App

.net - 为什么 Windows 窗体和库之间的 AppDomain.CurrentDomain.BaseDirectory 不同

c# - .net中的监视摄像机查看器编程

c# - Azure Blob 存储共享访问签名 (SAS) - 签名不匹配