YAFLogo

Posted by: Antelopetube - Thursday, 11 October 2018 12:30:07
I have been following the instruction here, to integrate YAF into my existing MVC application: https://github.com/YAFNET/YAFNET/wiki/YAF.NET-Integration-in-to-an-existing-ASP.NET-Application My application already uses ServiceStack, and I notice that the binaries for YAF include a version of ServiceStack. Additionally, my application is .net 4.5.2 and I think YAF is 4.0. I initially did not replace my existing ServiceStack dlls when I copied the bin folder from the YAF application into my existing bin folder, but I received an error message: [quote]Server Error in '/' Application. Could not load file or assembly 'ServiceStack.Interfaces, Version=3.9.14.0, Culture=neutral, PublicKeyToken=8b49dc47f4701f66' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) 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.IO.FileLoadException: Could not load file or assembly 'ServiceStack.Interfaces, Version=3.9.14.0, Culture=neutral, PublicKeyToken=8b49dc47f4701f66' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) 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. Assembly Load Trace: The following information can be helpful to determine why the assembly 'ServiceStack.Interfaces, Version=3.9.14.0, Culture=neutral, PublicKeyToken=8b49dc47f4701f66' could not be loaded. === Pre-bind state information === LOG: DisplayName = ServiceStack.Interfaces, Version=3.9.14.0, Culture=neutral, PublicKeyToken=8b49dc47f4701f66 (Fully-specified) LOG: Appbase = file:///C:/Users/forant/Documents/Visual Studio 2015/Projects/GAA/GAA/ LOG: Initial PrivatePath = C:\Users\forant\Documents\Visual Studio 2015\Projects\GAA\GAA\bin Calling assembly : YAF.Types, Version=2.0.0.0, Culture=neutral, PublicKeyToken=f3828393ba2d803c. === LOG: This bind starts in default load context. LOG: Using application configuration file: C:\Users\forant\Documents\Visual Studio 2015\Projects\GAA\GAA\web.config LOG: Using host configuration file: C:\Users\forant\Documents\IISExpress\config\aspnet.config LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config. LOG: Post-policy reference: ServiceStack.Interfaces, Version=3.9.14.0, Culture=neutral, PublicKeyToken=8b49dc47f4701f66 LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/root/9e5d23df/3d222704/ServiceStack.Interfaces.DLL. LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/root/9e5d23df/3d222704/ServiceStack.Interfaces/ServiceStack.Interfaces.DLL. LOG: Attempting download of new URL file:///C:/Users/forant/Documents/Visual Studio 2015/Projects/GAA/GAA/bin/ServiceStack.Interfaces.DLL. WRN: Comparing the assembly name resulted in the mismatch: Major Version ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated. Stack Trace: [FileLoadException: Could not load file or assembly 'ServiceStack.Interfaces, Version=3.9.14.0, Culture=neutral, PublicKeyToken=8b49dc47f4701f66' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)] 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) +145 System.Reflection.RuntimeModule.ResolveType(Int32 metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments) +130 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) +418 System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeType type, RuntimeType caType, Boolean inherit) +241 System.RuntimeType.GetCustomAttributes(Type attributeType, Boolean inherit) +58 YAF.Core.<>c__DisplayClass4`1.b__3(Type t) +40 System.Linq.WhereArrayIterator`1.MoveNext() +51 System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) +387 System.Linq.Enumerable.ToList(IEnumerable`1 source) +58 YAF.Core.<>c__DisplayClass4`1.b__2(Assembly a) +86 System.Linq.WhereSelectArrayIterator`2.MoveNext() +58 YAF.Core.AssemblyExtensions.FindClassesWithAttribute(IEnumerable`1 assemblies) +237 YAF.Core.Modules.DynamicServicesModule.RegisterDynamicServices(Assembly[] assemblies) +132 YAF.Core.Modules.DynamicServicesModule.Load(ContainerBuilder containerBuilder) +20 YAF.Core.BaseModule.Configure(IComponentRegistry componentRegistry) +90 Autofac.ContainerBuilder.Build(IComponentRegistry componentRegistry, Boolean excludeDefaultModules) +113 Autofac.ContainerBuilder.Update(IComponentRegistry componentRegistry) +14 YAF.Core.IHaveComponentRegistryExtensions.UpdateRegistry(IHaveComponentRegistry haveComponentRegistry, ContainerBuilder containerBuilder) +64 YAF.Core.BaseModule.RegisterBaseModules(Assembly[] assemblies, IEnumerable`1 exclude) +503 YAF.Core.Modules.BootstrapModule.Load(ContainerBuilder builder) +100 YAF.Core.BaseModule.Configure(IComponentRegistry componentRegistry) +90 Autofac.ContainerBuilder.Build(IComponentRegistry componentRegistry, Boolean excludeDefaultModules) +113 Autofac.ContainerBuilder.Build(ContainerBuildOptions options) +53 YAF.Core.GlobalContainer.CreateContainer() +81 YAF.Core.GlobalContainer..cctor() +14 [TypeInitializationException: The type initializer for 'YAF.Core.GlobalContainer' threw an exception.] YAF.Core.YafTaskModule.Init(HttpApplication httpApplication) +137 System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +536 System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +173 System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +336 System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +296 [HttpException (0x80004005): The type initializer for 'YAF.Core.GlobalContainer' threw an exception.] System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +10043752 System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +95 System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +254 [/quote] Figuring the version of ServiceStack I have is perhaps not compatible with the yaf app, I over-wrote the files in bin with the sample application Service Stack files. But I still get the same error message. Any suggestions as to how I resolve this? I'm really hoping the answer isn't binning all my existing nuget packages, downgrading my application to 4.0 and then reinstalling them all!... Thanks in advance Tony

Posted by: Zero2Cool - Friday, 12 October 2018 15:55:14
I'm not sure this is able to be done. I thought someone did though? I can't remember. http://yetanotherforum.net/forum/posts/t17810-YAF-integration-to-existing-asp-net-mvc-website http://yetanotherforum.net/forum/posts/t20572-C--ASP-NET-MVC-4-Application-YafMembershipProvider-Integration

Posted by: tha_watcha - Monday, 12 November 2018 03:05:37
[quote=Antelopetube;71629]Figuring the version of ServiceStack I have is perhaps not compatible with the yaf app, I over-wrote the files in bin with the sample application Service Stack files. But I still get the same error message. Any suggestions as to how I resolve this? I'm really hoping the answer isn't binning all my existing nuget packages, downgrading my application to 4.0 and then reinstalling them all!... Thanks in advance Tony[/quote] Sorry for the late answer. The latest YAF.NET uses .NET 4.5.2 so you have not to downgrade your app. YAF.NET uses Service Stack 5.1.0 in order to integrate YAF in to your app you would need to update your nuget references to ServiceStack 5.1.0