无法加载类型'Microsoft.WindowsAzure.CloudConfigurationManager&
本文关键字:Microsoft WindowsAzure CloudConfigurationManager 加载 类型 | 更新日期: 2023-09-27 18:07:10
我正在尝试使用Elmah插件用于Azure表存储,但此异常正在抛出。
[TypeLoadException: Could not load typ'Microsoft.WindowsAzure.CloudConfigurationManager' from assembly 'Microsoft.WindowsAzure.Configuration, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.]
Elmah.AzureTableStorage.ElmahHelper.GetConnectionString(IDictionary config) +0
Elmah.AzureTableStorage.AzureTableStorageErrorLog..ctor(IDictionary config) +44
[TargetInvocationException: Exception has been thrown by the target of an invocation.]
System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) +0
System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +225
System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, StackCrawlMark& stackMark) +1117
System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) +124
System.Activator.CreateInstance(Type type, Object[] args) +21
Elmah.SimpleServiceProviderFactory.CreateFromConfigSection(String sectionName) +202
Elmah.ErrorLog.GetDefaultImpl(HttpContext context) +117
Elmah.ServiceContainer.GetService(Type serviceType) +49
Elmah.ServiceCenter.FindService(Object context, Type serviceType) +25
Elmah.ServiceCenter.GetService(Object context, Type serviceType) +31
Elmah.ErrorLog.GetDefault(HttpContext context) +22
Elmah.ErrorPageBase.get_ErrorLog() +32
Elmah.ErrorLogPage.OnLoad(EventArgs e) +313
System.Web.UI.Control.LoadRecursive() +97
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean
我尝试通过nuget更新相关的Azure包,但仍然得到这个异常。
如果您已经从nuget安装了最新的CloudConfigurationManager,您可能已经安装了3.1.0。我点击了上面插件的链接,它说有一个使用3.1.0的更新,所以升级插件可能会解决你的问题。或者,检查配置文件中是否有过期的绑定重定向,或者添加一个来引用您已安装的CloudConfigurationManager的版本。