我正在實現自定義FormsAuthenticationProvider
,我收到中間件轉換錯誤。使用Owin,Katana和Nancy實現自定義FormsAuthenticationProvider
No conversion available between System.Func`2[System.Collections.Generic.IDictionary`2
[System.String,System.Object],System.Threading.Tasks.Task] and Microsoft.Owin.OwinMiddleware
Parameter name: signature
我的籌碼包括
- Owin
- 武士刀
- 南希
我的具體問題將是在哪裏尋找關於如何實現一個例子任何意見自定義FormsAuthenticationProvider
?除非有人能夠發現我的問題。
我的實現是這樣的:
Startup.cs
app.UseFormsAuthentication(new FormsAuthenticationOptions
{
LoginPath = "/login",
LogoutPath = "/logout",
CookieHttpOnly = true,
AuthenticationType = Constants.ChainLinkAuthType,
CookieName = "chainlink.id",
ExpireTimeSpan = TimeSpan.FromDays(30),
Provider = kernel.Get<IFormsAuthenticationProvider>()
});
如果我刪除了應用程序運行而不會出現錯誤的app.UseFormsAuthentication(...)
。
完整的堆棧跟蹤
[ArgumentException: No conversion available between System.Func`2[System.Collections.Generic.IDictionary`2[System.String,System.Object],System.Threading.Tasks.Task] and Microsoft.Owin.OwinMiddleware
Parameter name: signature]
Owin.Builder.AppBuilder.Convert(Type signature, Object app) +328
Owin.Builder.AppBuilder.BuildInternal(Type signature) +336
Owin.Builder.AppBuilder.Build(Type returnType) +42
Microsoft.Owin.Host.SystemWeb.OwinAppContext.Initialize(Action`1 startup) +650
Microsoft.Owin.Host.SystemWeb.OwinBuilder.Build(Action`1 startup) +86
Microsoft.Owin.Host.SystemWeb.OwinBuilder.Build() +185
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
[HttpException (0x80004005): No conversion available between System.Func`2[System.Collections.Generic.IDictionary`2[System.String,System.Object],System.Threading.Tasks.Task] and Microsoft.Owin.OwinMiddleware
Parameter name: signature]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9874568
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +101
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +254
可執行源代碼(只是F5它,你會得到立即錯誤)
https://github.com/cnwilkin/ChainLink/tree/spike
非常感謝,修復了一切。 –
我進入nuget並單擊更新所有和轉換錯誤消失 – Luke