无法从程序集“mscorlib”加载类型“System.Runtime.CompilerServices.ScriptAssemblyAttribute”

时间:2017-05-05 10:19:03

标签: c# asp.net-mvc azure

您好我在C#on dot net 4.5上有一个MVC ASP网络应用程序正常工作,直到我添加了对Microsoft.Owin.Host.SystemWeb nuget包的引用,以使用Azure B2C登录和注册,就在我的时候每当我尝试运行Web应用程序时出现以下错误:

Could not load type 'System.Runtime.CompilerServices.ScriptAssemblyAttribute' from assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.

我还没有调用任何新函数,我只是添加了nuget包,它就像那样崩溃了。我在Windows 10上使用visual studio 2015,项目是dot net framework 4.5。

任何帮助都非常感谢,因为我已经在这方面苦苦挣扎了几天,我不知道从哪里开始解决这个问题。

以下是添加到我的项目中的所有其他nuget包的列表及其版本号:

Antlr                   v3.5.0.2        
AutoMapper              v4.2.1          
bootstrap               v3.3.7          
bootstrap.v3.datetimepicker.css     v4.15.35        
buildwebcompiler            v1.11.323       
jquery                  v3.1.0          
jquery.validation           v1.15.1         
microsoft.aspnet.mvc            v5.2.3          
microsoft.aspnet.razor          v3.2.3          
microsoft.aspnet.web.optimization   v1.1.3          
Microsoft.AspNet.WebApi         v5.2.3          
Microsoft.AspNet.WebApi.Client      v5.2.3          
Microsoft.AspNet.WebApi.Core        v5.2.3          
Microsoft.AspNet.WebApi.WebHost     v5.2.3          
Microsoft.AspNet.WebPages       v3.2.3          
microsoft.csharp            v4.0.1          
Microsoft.jQuery.Unobtrusive.Validation v3.2.3      
Microsoft.Web.Infrastructure        v1.0.0          
Modernizr               v2.8.3          
moment.js               v2.15.1         
Newtonsoft.Json             v9.0.1          
respond                 v1.4.2          
SharpShooter.Reports.Web.ASP.NET.Web    v2.1.1          
UnofficialAzure.StorageClient       v1.0.0
webgrease               v1.6.0          
windowsbase             v4.6.1055

这是堆栈跟踪:

[TypeLoadException: Could not load type 'System.Runtime.CompilerServices.ScriptAssemblyAttribute' from assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.]
   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(Boolean inherit) +37
   Owin.Loader.DefaultLoader.SearchForStartupAttribute(String friendlyName, IList`1 errors, Boolean& conflict) +106
   Owin.Loader.DefaultLoader.GetDefaultConfiguration(String friendlyName, IList`1 errors) +46
   Owin.Loader.DefaultLoader.LoadImplementation(String startupName, IList`1 errorDetails) +75
   Owin.Loader.DefaultLoader.Load(String startupName, IList`1 errorDetails) +21
   Microsoft.Owin.Host.SystemWeb.OwinBuilder.GetAppStartup() +115
   Microsoft.Owin.Host.SystemWeb.OwinHttpModule.InitializeBlueprint() +28
   System.Threading.LazyInitializer.EnsureInitializedCore(T& target, Boolean& initialized, Object& syncLock, Func`1 valueFactory) +115
   Microsoft.Owin.Host.SystemWeb.OwinHttpModule.Init(HttpApplication context) +106
   System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +534
   System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +172
   System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +339
   System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +296

[HttpException (0x80004005): Could not load type 'System.Runtime.CompilerServices.ScriptAssemblyAttribute' from assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.]
   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9922840
   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +90
   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +261

如果您希望我提供任何其他信息,请与我们联系。

感谢。

0 个答案:

没有答案