有没有成熟的、Mono兼容的FastCGI库?
我想建立一个在 Mono 上运行的持久应用程序服务器,它需要能够接受 Web 请求并返回一些合适的响应。这是一个简单的任务,几乎就是 FastCGI 的用途,但我似乎找不到不与 ASP.NET 粘合在一起的 FastCGI 解决方案。
需要特别说明的是:我对 ASP.NET 不感兴趣,也不想使用它或尝试选择 ASP.NET 堆栈的任何部分。我真正需要的是一种通过 FastCGI 与网络服务器交互的方法,其余的我可以弄清楚。
I would like to set up a persistent application server running on Mono that needs to be able to accept web requests and return some suitable response. It's a simple task, and pretty much what FastCGI is for, but I can't seem to find a FastCGI solution that is not glued together with ASP.NET.
To be extra clear: I am not interested in ASP.NET and do not want to use it or attempt to co-opt any part of the ASP.NET stack. All I really need is a way to interface with a webserver through FastCGI and I can figure out the rest.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
虽然 Mono FastCGI 实现始终与 ASP.NET 服务器打包在一起,但我编写代码的方式使其可以与任何类型的服务器实现一起使用。这是一个应该有效的基本示例。您的请求特定代码位于
Process
方法中,您可以通过ResponderRequest.GetParameter
访问 FastCGI 环境变量。要构建此示例,您可以从 https 下载所有 CS 文件: //github.com/mono/xsp/tree/master/src/Mono.WebServer.FastCgi 并排除任何不使用
Mono.FastCgi
命名空间的文件。While the Mono FastCGI implementation is always packaged with a ASP.NET server, I wrote the code in such a way that it can be used with any sort of server implementation. Here is a basic example that should work. Your request specific code goes in the
Process
method and you can access FastCGI environment variables throughResponderRequest.GetParameter
.To build this example, you can download all the CS files from https://github.com/mono/xsp/tree/master/src/Mono.WebServer.FastCgi and just exclude any files that don't use the
Mono.FastCgi
namespace.也许您可以将 FASTCGI C 库连接到 Mono。
另一种可能性是使用 SCGI 协议。该协议(某种程度上比 FastCGI 效率低)与 FastCGI 共享让持久应用程序为 Web 服务器工作的能力。但 SCGI 非常简单,编写您自己的 SCGI 协议实现非常简单(假设您具有 HTTP 的应用知识)。
Perhaps you might interface the FASTCGI C library to Mono.
Another possibility could be to use the SCGI protocol. That protocol (somehow less efficient than FastCGI) share with FastCGI the ability to have a persistent application working for a web server. But SCGI is so simple that writing your own SCGI protocol implementation is very simple (assuming you have a working knowledge of HTTP).