【发布时间】:2014-05-30 11:26:20
【问题描述】:
当我将下面的行添加到我的 Startup 类时,我得到下面的异常。这是一个从单声道(Ubuntu)运行的自托管 exe。它在 Windows 中运行良好。我已经缩小了 UseCookieAuthentication 调用的范围。我可以毫无问题地实例化选项。知道这里发生了什么吗?我有 aspnet Identity 和 EF6/MySql。
app.UseCookieAuthentication(new CookieAuthenticationOptions());
未处理的异常: System.Reflection.TargetInvocationException:调用的目标已引发异常。 ---> System.TypeLoadException:无法从程序集“Microsoft.Owin.Security,Version=2.1.0.0,Culture=neutral,PublicKeyToken=31bf3856ad364e35”加载类型“Microsoft.Owin.Security.DataProtection.DpapiDataProtector”。 在 Microsoft.Owin.Security.DataProtection.AppBuilderExtensions.CreateDataProtector (Owin.IAppBuilder,string[]) 在 Microsoft.Owin.Security.Cookies.CookieAuthenticationMiddleware..ctor (Microsoft.Owin.OwinMiddleware,Owin.IAppBuilder,Microsoft.Owin.Security.Cookies.CookieAuthenticationOptions) 在(包装器动态方法)object.lambda_method(System.Runtime.CompilerServices.Closure,Microsoft.Owin.OwinMiddleware,Owin.IAppBuilder,Microsoft.Owin.Security.Cookies.CookieAuthenticationOptions) 在(包装器托管到本机)System.Reflection.MonoMethod.InternalInvoke(System.Reflection.MonoMethod,object,object[],System.Exception&) 在 System.Reflection.MonoMethod.Invoke (object,System.Reflection.BindingFlags,System.Reflection.Binder,object[],System.Globalization.CultureInfo)
--- 内部异常堆栈跟踪结束 --- 在 System.Reflection.MonoMethod.Invoke(System.Object obj,BindingFlags invokeAttr,System.Reflection.Binder binder,System.Object[] 参数,System.Globalization.CultureInfo 文化)[0x00000] 中:0 在 System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] 参数) [0x00000] in :0 在 System.Delegate.DynamicInvokeImpl (System.Object[] args) [0x00000] in :0 在 System.MulticastDelegate.DynamicInvokeImpl (System.Object[] args) [0x00000] in :0 在 System.Delegate.DynamicInvoke (System.Object[] args) [0x00000] in :0 在 Microsoft.Owin.Builder.AppBuilder.BuildInternal(System.Type 签名)[0x00000] 中:0 在 Microsoft.Owin.Builder.AppBuilder.Build (System.Type returnType) [0x00000] in :0 在 Microsoft.Owin.Hosting.ServerFactory.ServerFactoryAdapter.Create(IAppBuilder 生成器)[0x00000] 中:0 在 Microsoft.Owin.Hosting.Engine.HostingEngine.StartServer(Microsoft.Owin.Hosting.Engine.StartContext 上下文)[0x00000] 中:0 在 Microsoft.Owin.Hosting.Engine.HostingEngine.Start(Microsoft.Owin.Hosting.Engine.StartContext 上下文)[0x00000] 中:0 在 Microsoft.Owin.Hosting.Starter.DirectHostingStarter.Start(Microsoft.Owin.Hosting.StartOptions 选项)[0x00000] 中:0 在 Microsoft.Owin.Hosting.Starter.HostingStarter.Start(Microsoft.Owin.Hosting.StartOptions 选项)[0x00000] 中:0 在 Microsoft.Owin.Hosting.WebApp.StartImplementation(IServiceProvider 服务,Microsoft.Owin.Hosting.StartOptions 选项)[0x00000] 中:0 在 Microsoft.Owin.Hosting.WebApp.Start(Microsoft.Owin.Hosting.StartOptions 选项)[0x00000] 中:0 在 Microsoft.Owin.Hosting.WebApp.Start[Startup](Microsoft.Owin.Hosting.StartOptions 选项)[0x00000] 中:0 在 Microsoft.Owin.Hosting.WebApp.Start[Startup] (System.String url) [0x00000] in :0 在 HelloWorldNancy.Program.Main (System.String[] args) [0x00000] in :0 [错误] 致命的未处理异常:System.Reflection.TargetInvocationException:调用目标已引发异常。 ---> System.TypeLoadException:无法从程序集“Microsoft.Owin.Security,Version=2.1.0.0,Culture=neutral,PublicKeyToken=31bf3856ad364e35”加载类型“Microsoft.Owin.Security.DataProtection.DpapiDataProtector”。 在 Microsoft.Owin.Security.DataProtection.AppBuilderExtensions.CreateDataProtector (Owin.IAppBuilder,string[]) 在 Microsoft.Owin.Security.Cookies.CookieAuthenticationMiddleware..ctor (Microsoft.Owin.OwinMiddleware,Owin.IAppBuilder,Microsoft.Owin.Security.Cookies.CookieAuthenticationOptions) 在(包装器动态方法)object.lambda_method(System.Runtime.CompilerServices.Closure,Microsoft.Owin.OwinMiddleware,Owin.IAppBuilder,Microsoft.Owin.Security.Cookies.CookieAuthenticationOptions) 在(包装器托管到本机)System.Reflection.MonoMethod.InternalInvoke(System.Reflection.MonoMethod,object,object[],System.Exception&) 在 System.Reflection.MonoMethod.Invoke (object,System.Reflection.BindingFlags,System.Reflection.Binder,object[],System.Globalization.CultureInfo)
--- 内部异常堆栈跟踪结束 --- 在 System.Reflection.MonoMethod.Invoke(System.Object obj,BindingFlags invokeAttr,System.Reflection.Binder binder,System.Object[] 参数,System.Globalization.CultureInfo 文化)[0x00000] 中:0 在 System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] 参数) [0x00000] in :0 在 System.Delegate.DynamicInvokeImpl (System.Object[] args) [0x00000] in :0 在 System.MulticastDelegate.DynamicInvokeImpl (System.Object[] args) [0x00000] in :0 在 System.Delegate.DynamicInvoke (System.Object[] args) [0x00000] in :0 在 Microsoft.Owin.Builder.AppBuilder.BuildInternal(System.Type 签名)[0x00000] 中:0 在 Microsoft.Owin.Builder.AppBuilder.Build (System.Type returnType) [0x00000] in :0 在 Microsoft.Owin.Hosting.ServerFactory.ServerFactoryAdapter.Create(IAppBuilder 生成器)[0x00000] 中:0 在 Microsoft.Owin.Hosting.Engine.HostingEngine.StartServer(Microsoft.Owin.Hosting.Engine.StartContext 上下文)[0x00000] 中:0 在 Microsoft.Owin.Hosting.Engine.HostingEngine.Start(Microsoft.Owin.Hosting.Engine.StartContext 上下文)[0x00000] 中:0 在 Microsoft.Owin.Hosting.Starter.DirectHostingStarter.Start(Microsoft.Owin.Hosting.StartOptions 选项)[0x00000] 中:0 在 Microsoft.Owin.Hosting.Starter.HostingStarter.Start(Microsoft.Owin.Hosting.StartOptions 选项)[0x00000] 中:0 在 Microsoft.Owin.Hosting.WebApp.StartImplementation(IServiceProvider 服务,Microsoft.Owin.Hosting.StartOptions 选项)[0x00000] 中:0 在 Microsoft.Owin.Hosting.WebApp.Start(Microsoft.Owin.Hosting.StartOptions 选项)[0x00000] 中:0 在 Microsoft.Owin.Hosting.WebApp.Start[Startup](Microsoft.Owin.Hosting.StartOptions 选项)[0x00000] 中:0 在 Microsoft.Owin.Hosting.WebApp.Start[Startup] (System.String url) [0x00000] in :0 在 HelloWorldNancy.Program.Main (System.String[] args) [0x00000] in :0
【问题讨论】:
标签: mono asp.net-identity owin