1

SignalR 1.x を自分のプロジェクト (.net 4.0 で実行) に統合しようとしています。RouteTable.Routes.MapHubs() を呼び出すときに問題が発生しています。他のルートが構成される前に、Global.asax の Application_Start 内で呼び出しを行っています。

次のような例外が発生します。

    [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

RouteTable.Routes.MapHubs() を呼び出したときにエラーが発生するのではなく、後でリクエストが行われたときに発生することに注意してください。グーグルはこの質問を明らかにしました:

https://github.com/owin/owin-hosting/issues/17

しかし、SignalR 2.x には .net 4.5 が必要なため、アップグレードできません。

4

1 に答える 1