You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I got FOS from nuget and tried to use it with Microsoft.AspNet.WebApi.Owin, and got the following exception when making a request:
System.ArgumentException: Cannot bind to the target method because its signature or security transparency is not compatible with that of the delegate type.
at System.Delegate.CreateDelegate(Type type, Object target, String method, Boolean ignoreCase, Boolean throwOnBindFailure)
at Fos.Owin.OwinMiddleware.BuildHandler()
at Fos.Owin.OwinMiddleware.get_Handler()
at Fos.Owin.OwinMiddleware.Invoke(IDictionary`2 owinParameters)
at Fos.Listener.FosRequest.ProcessRequest()
I cloned the repository and debugged through it. The problem appears to be that FosAppBuilder expects all middleware to have an Invoke method can be created as a delegate of type Func<IDictionary<string, object>, Task>. Several of the newer middlewares have an invoke method signature of Func<Microsoft.Owin.IOwinContext, Task>. The System.Web.Http.Owin,HttpMessageHandlerAdapter middleware registered by UseWebApi() is one of these middlewares.
Microsoft.Owin.Builder.AppBuilder already handles conversion between these two signatures and by having FosAppBuilder inherit from Microsoft.Owin.Builder.AppBuilder, I was able to successfully use the WebApi middleware over fastcgi for my application.
The text was updated successfully, but these errors were encountered:
mikdav
added a commit
to mikdav/Fos
that referenced
this issue
May 16, 2018
I got FOS from nuget and tried to use it with Microsoft.AspNet.WebApi.Owin, and got the following exception when making a request:
System.ArgumentException: Cannot bind to the target method because its signature or security transparency is not compatible with that of the delegate type.
at System.Delegate.CreateDelegate(Type type, Object target, String method, Boolean ignoreCase, Boolean throwOnBindFailure)
at Fos.Owin.OwinMiddleware.BuildHandler()
at Fos.Owin.OwinMiddleware.get_Handler()
at Fos.Owin.OwinMiddleware.Invoke(IDictionary`2 owinParameters)
at Fos.Listener.FosRequest.ProcessRequest()
I cloned the repository and debugged through it. The problem appears to be that FosAppBuilder expects all middleware to have an Invoke method can be created as a delegate of type Func<IDictionary<string, object>, Task>. Several of the newer middlewares have an invoke method signature of Func<Microsoft.Owin.IOwinContext, Task>. The System.Web.Http.Owin,HttpMessageHandlerAdapter middleware registered by UseWebApi() is one of these middlewares.
Microsoft.Owin.Builder.AppBuilder already handles conversion between these two signatures and by having FosAppBuilder inherit from Microsoft.Owin.Builder.AppBuilder, I was able to successfully use the WebApi middleware over fastcgi for my application.
The text was updated successfully, but these errors were encountered: