I am working on implementing a custom FormsAuthenticationProvider
and I'm getting a middleware conversion error.
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
My stack includes
- Owin
- Katana
- Nancy
My specific question would be any advice on where to look for an example on how to implement a custom FormsAuthenticationProvider
? Unless someone can spot my problem.
My implementation looks like:
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>()
});
If I remove the app.UseFormsAuthentication(...)
the application runs without error.
Full Stack Trace
[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
Executable Source Code (Just F5 it and you'll get the error immediately)