0

httpmodules クラスを httplistener Web サービスで使用するにはどうすればよいですか

ここに私のhttpモジュールコードがあります:

using System;  
using System.Web;   
using System.Collections;  

public class MyCustomHttpModule: IHttpModule 
{  
    public String ModuleName 
    {   
        application.BeginRequest += (new EventHandler(this.Application_BeginRequest));  
        application.EndRequest += (new EventHandler(this.Application_EndRequest));  
    }  

    private void Application_BeginRequest(Object source, EventArgs e) 
    {  
        HttpApplication application = (HttpApplication)source;  
        HttpContext context = application.Context;  
        context.Response.Write("<h1>MyCustomHttpModule: Beginning of Request...</h1><br/>");  
    }  

    private void Application_EndRequest(Object source, EventArgs e) 
    {  
        HttpApplication application = (HttpApplication)source;  
        HttpContext context = application.Context;  
        context.Response.Write("<h1>MyCustomHttpModule: End of Request...</h1>");  
    }          

    public void Dispose()   
    {  
    }  
}  

以下のhttplistenerコード:

using HttpListener = HttpServer.HttpListener;

public class Loader
{
    static void Main(string[] args)
    {
        HttpListener listener = HttpListener.Create(IPAddress.Any, 8089);
        DynamicModuleUtility.RegisterModule(typeof(FileWebDAVModule));
        listener.Start(5);
        Thread.Sleep(90000000);
    }

}

httplistener サービスを使用して httpmodule を呼び出すにはどうすればよいですか。よろしくお願いします。

4

0 に答える 0