|
|
Hi
I am trying to setup up Combres in a asp.net mvc 2.0 .net 4 application. I however keep getting the same error and I am not sure why. I am following the 2.0 tutorial on codeplex.
System.TypeInitializationException was unhandled by user code
Message=The type initializer for 'Combres.Configuration' threw an exception.
Source=Combres
TypeName=Combres.Configuration
StackTrace:
at Combres.Configuration.GetCombresUrl()
at Combres.WebExtensions.AddCombresRoute(RouteCollection routes, String name)
at Project.WebUI.MvcApplication.RegisterRoutes(RouteCollection routes) in C:\Users\UserName\Desktop\Osp4\Trunk\Project\Project.WebUI\Global.asax.cs:line 18
at Project.WebUI.MvcApplication.Application_Start() in C:\Users\UserName\Desktop\Osp4\Trunk\Project\Project.WebUI\Global.asax.cs:line 34
InnerException: System.TypeInitializationException
Message=The type initializer for 'Combres.LoggerFactory' threw an exception.
Source=Combres
TypeName=Combres.LoggerFactory
StackTrace:
at Combres.LoggerFactory.CreateLogger(Type type)
at Combres.Configuration..cctor()
InnerException: System.Configuration.ConfigurationErrorsException
Message=An error occurred creating the configuration section handler for combres: Could not load file or assembly 'Combres, Version=2.1.0.0, Culture=neutral, PublicKeyToken=49212d24adfbe4b4' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) (C:\Users\UserName\Desktop\Osp4\Trunk\Project\Project.WebUI\web.config line 11)
Source=System.Configuration
BareMessage=An error occurred creating the configuration section handler for combres: Could not load file or assembly 'Combres, Version=2.1.0.0, Culture=neutral, PublicKeyToken=49212d24adfbe4b4' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Filename=C:\Users\UserName\Desktop\Osp4\Trunk\Project\Project.WebUI\web.config
Line=11
StackTrace:
at System.Configuration.BaseConfigurationRecord.FindAndEnsureFactoryRecord(String configKey, Boolean& isRootDeclaredHere)
at System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject)
at System.Configuration.BaseConfigurationRecord.GetSection(String configKey)
at System.Web.HttpContext.GetSection(String sectionName)
at System.Web.Configuration.HttpConfigurationSystem.GetSection(String sectionName)
at System.Web.Configuration.HttpConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.GetSection(String configKey)
at System.Configuration.ConfigurationManager.GetSection(String sectionName)
at Combres.ConfigSectionSetting.Get()
at Combres.LoggerFactory..cctor()
InnerException: System.IO.FileLoadException
Message=Could not load file or assembly 'Combres, Version=2.1.0.0, Culture=neutral, PublicKeyToken=49212d24adfbe4b4' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Source=System.Configuration
FileName=Combres, Version=2.1.0.0, Culture=neutral, PublicKeyToken=49212d24adfbe4b4
FusionLog==== Pre-bind state information ===
LOG: User = Computer\UserName
LOG: DisplayName = Combres, Version=2.1.0.0, Culture=neutral, PublicKeyToken=49212d24adfbe4b4
(Fully-specified)
LOG: Appbase = file:///C:/Users/UserName/Desktop/Osp4/Trunk/Project/Project.WebUI/
LOG: Initial PrivatePath = C:\Users\UserName\Desktop\Osp4\Trunk\Project\Project.WebUI\bin
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Users\UserName\Desktop\Osp4\Trunk\Project\Project.WebUI\web.config
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Post-policy reference: Combres, Version=2.1.0.0, Culture=neutral, PublicKeyToken=49212d24adfbe4b4
LOG: Attempting download of new URL file:///C:/Users/UserName/AppData/Local/Temp/Temporary ASP.NET Files/root/a11c50f1/752d024a/Combres.DLL.
LOG: Attempting download of new URL file:///C:/Users/UserName/AppData/Local/Temp/Temporary ASP.NET Files/root/a11c50f1/752d024a/Combres/Combres.DLL.
LOG: Attempting download of new URL file:///C:/Users/UserName/Desktop/Osp4/Trunk/Project/Project.WebUI/bin/Combres.DLL.
WRN: Comparing the assembly name resulted in the mismatch: PUBLIC KEY TOKEN
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.
StackTrace:
at System.Configuration.TypeUtil.GetTypeWithReflectionPermission(IInternalConfigHost host, String typeString, Boolean throwOnError)
at System.Configuration.RuntimeConfigurationRecord.RuntimeConfigurationFactory.Init(RuntimeConfigurationRecord configRecord, FactoryRecord factoryRecord)
at System.Configuration.RuntimeConfigurationRecord.RuntimeConfigurationFactory.InitWithRestrictedPermissions(RuntimeConfigurationRecord configRecord, FactoryRecord factoryRecord)
at System.Configuration.RuntimeConfigurationRecord.CreateSectionFactory(FactoryRecord factoryRecord)
at System.Configuration.BaseConfigurationRecord.FindAndEnsureFactoryRecord(String configKey, Boolean& isRootDeclaredHere)
InnerException:
webconfig line 10 to 14
<configSections>
<section name="combres" type="Combres.ConfigSectionSetting, Combres, Version=2.1.0.0, Culture=neutral, PublicKeyToken=49212d24adfbe4b4"/>
</configSections>
<combres definitionUrl="~/App_Data/Combres.xml" />
line 39 to 42
<httpModules>
<add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web.Routing, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
</httpModules>
Global.aspx
routes.AddCombresRoute("Combres");
|
|
|
|
Check the public key token of combres.dll using .NET Reflector - the current 2.1 release does not match that used in the sample code on Code Project. My configuration file reads:
<section name="combres" type="Combres.ConfigSectionSetting, Combres, Version=2.1.0.0, Culture=neutral, PublicKeyToken=1ca6b37997dd7536"/>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, Combres, Version=2.1.0.0, Culture=neutral, PublicKeyToken=1ca6b37997dd7536"/>
Hope that helps.
|
|
|
|
I think it will be to do with a log4net dll conflict. Combres uses one version and I am guessing your project uses another. I am having the same problem with minimal success in fixing it.
|
|