Reputation: 3885
I am trying to integrate SignalR 1.x into my project (running on .net 4.0). I am having an issue that when I call RouteTable.Routes.MapHubs(). I'm making the call within the Application_Start on in the Global.asax before any other Routes are configured.
I end up getting an exception like this:
[FileLoadException: API restriction: The assembly 'file:///C:\Users\Kyle\Documents\<Project>\bin\Debug\<Name>.dll' has already loaded from a different location. It cannot be loaded from a new location within the same appdomain.]
System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +0
System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +34
System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +152
System.Reflection.RuntimeAssembly.InternalLoadFrom(String assemblyFile, Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm, Boolean forIntrospection, Boolean suppressSecurityChecks, StackCrawlMark& stackMark) +102
System.Reflection.Assembly.ReflectionOnlyLoadFrom(String assemblyFile) +34
Owin.Loader.DefaultLoader.GetDefaultConfigurationString(Func`2 defaultTypeNames) +774
Owin.Loader.DefaultLoader.LoadImplementation(String startupName) +177
Owin.Loader.DefaultLoader.Load(String startupName) +45
Microsoft.Owin.Host.SystemWeb.OwinBuilder.Build() +167
System.Lazy`1.CreateValue() +416
System.Lazy`1.LazyInitValue() +152
System.Lazy`1.get_Value() +75
Microsoft.Owin.Host.SystemWeb.OwinApplication.get_Instance() +35
Microsoft.Owin.Host.SystemWeb.OwinHttpModule.Init(HttpApplication context) +106
System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +418
System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +172
System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +336
System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +296
Note that the error does not occur when I make the call to RouteTable.Routes.MapHubs(), but rather later when a request is made. Googling has revealed this question:
https://github.com/owin/owin-hosting/issues/17
But I can't upgrade since SignalR 2.x requires .net 4.5.
Upvotes: 1
Views: 704
Reputation: 3885
The answer seems to have been to upgrade the owin packages without upgrading the SignalR ones. So using NuGet:
Install-Package Microsoft.Owin.Host.SystemWeb -Version 2.0.1
Install-Package Microsoft.AspNet.SignalR.SystemWeb -Version 1.1.3
Upvotes: 1