我想使用 IHttpHandler 方法在 .Net-Project 中使用 XSP 或更好的 mod_mono。
我有以下课程(很简单:
public class Class1 : IHttpHandler
{
public bool IsReusable
{
get { return false; }
}
public void ProcessRequest(HttpContext context)
{
var result = "<h1>Yeah</h1>";
var bytes = Encoding.UTF8.GetBytes(result);
context.Response.Write(result);
}
}
以及以下 web.config
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<handlers accessPolicy="Read, Execute, Script">
<add name="Class" path="*" verb="*" type="IISHost.Class1" resourceType="Unspecified" preCondition="integratedMode" />
</handlers>
</system.webServer>
<system.web>
<compilation defaultLanguage="c#" />
</system.web>
</configuration>
它在 IIS 中运行良好。http://127.0.0.1/test/kfdlsa返回“是”
在 Apache 上的 XSP 或 mod_mono 中,我可以创建一个 index.aspx,它可以根据 .Net-Framework 完美地解析和执行,但似乎该处理程序不包含在 mod_mono-Framework 中。
是使用真正在 Mono 中实现的 IHttpHandler,还是应该使用另一种方法将所有请求收集到某个主机和/或虚拟目录。