Mono and IHttpHandler

I would like to use XSP or better mod_mono in a .NET project using the IHttpHandler method.

I have the following class (pretty simple:

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);
    }
}

And the next 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>

It works great in IIS. http://127.0.0.1/test/kfdlsa returns "Yes"

In XSP or mod_mono on Apache, I can create index.aspx that parses and runs fine according to the .Net-Framework, but it seems the handler is not included in the mod_mono-Framework.

Uses IHttpHandler, really implemented in Mono, or I have to use a different approach to collect all requests to a specific host and / or virtual directory.

+5
1

HTTP Mono.

, Web.config , "Integrated Pipeline" IIS. Apache/mod_mono. (.. , " " ) <system.web/httpHandlers> <system.webServer/handlers>.

. Web.config:

<?xml version="1.0"?>
<configuration>
    <system.web>
        <httpHandlers>
            <add path="*.rss" verb="*" type="CedricBelin.Web.FeedHandler" />
        </httpHandlers>
    </system.web>

    <system.webServer>
        <handlers>
            <add name="Feed" path="*.rss" verb="*" type="CedricBelin.Web.FeedHandler" />
        </handlers>

        <validation validateIntegratedModeConfiguration="false" />
    </system.webServer>
</configuration>

<validation ...> : , IIS , Integrated Pipeline .

Apache mod_mono, :

<VirtualHost *:80>
    ServerName mono.localhost
    DocumentRoot "/Library/WebServer/Documents/MonoTest"
    AddType application/x-asp-net .rss
</VirtualHost>

AddType application/x-asp-net .rss . . path="*.rss" Web.config .rss . , (path="*"), AddType application/x-asp-net .rss ForceType application/x-asp-net.

+11

All Articles