mzabani / fos Goto Github PK
View Code? Open in Web Editor NEWFastCgi Server designed to run Owin applications side by side with a FastCgi enabled web server.
License: BSD 2-Clause "Simplified" License
FastCgi Server designed to run Owin applications side by side with a FastCgi enabled web server.
License: BSD 2-Clause "Simplified" License
We need to have a separate NuGet package for Mono to support Unix Sockets. FastCgiNet should do the same before we can do this.
Self-Explanatory.
IIS has two options for FastCGI - named pipes and TCP. FOS supports unix named pipes and TCP. However, the way that IIS uses TCP is not compatible with the way that FOS uses TCP.
In the case of named pipes, IIS creates a named pipe and passes it to the FastCGI process as StdIn. The FastCGI process is then expected to duplicate the handle and use the pipe for reading/writing.
In the case of TCP, IIS opens a transient port and then passes a handle to the FastCGI process also as StdIn. The FastCGI process is then expected to duplicate the handle and use it for read/writing. IIS will not connect to a FastCGI process listening on a specific port.
A possible fix would be to add a BindToIisStdIn method to SocketListener that would pull the correct handle/socket from StdIn in order to communicate with IIS.
Wired up a test application with UseActiveDirectoryFederationServicesBearerAuthentication, and get the following exception:
System.NotSupportedException: The OWIN key 'server.OnSendingHeaders' is not available for this request.
at Microsoft.Owin.OwinResponse.OnSendingHeaders(Action1 callback, Object state) at Microsoft.Owin.Security.Infrastructure.AuthenticationHandler.<BaseInitializeAsync>d__0.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Owin.Security.Infrastructure.AuthenticationMiddleware
1.d__0.MoveNext()
--- End of inner exception stack trace ---
---> (Inner Exception #0) System.NotSupportedException: The OWIN key 'server.OnSendingHeaders' is not available for this request.
at Microsoft.Owin.OwinResponse.OnSendingHeaders(Action1 callback, Object state) at Microsoft.Owin.Security.Infrastructure.AuthenticationHandler.<BaseInitializeAsync>d__0.MoveNext() --- End of stack trace from previous location where exception was thrown ---<br /> at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Owin.Security.Infrastructure.AuthenticationMiddleware
1.d__0.MoveNext()
The FosRequest class would need to be able to handle the common key server.OnSendingHeaders (defined here: http://owin.org/spec/spec/CommonKeys.html#_6._Common_keys) in order to use these middlewares.
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.