C# HTTPModule Could not load type CGI Request

Trying to use a HTTPModule I wrote in complied C# class project to log request values and extend a third party CGI shopping cart. My module works fine with asp,asp.net,jpg and html request, but soon as I request the store.cgi, I get the following error. Do I have to do something special in IIS7 or does HTTPModule not work with a CGI executables running in CGI-BIN?

Server Error in '/cgi-bin' Application.

Could not load type 'IISWatcher.WatchRequests'. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Web.HttpException: Could not load type 'IISWatcher.WatchRequests'.

Source Code:



using System;
using System.Collections.Generic;
using System.Text;
using System.Web;
using System.Messaging;

namespace IISWatcher
{
    public class WatchRequests : IHttpModule
    {
        public void Init(System.Web.HttpApplication app)
        {
            app.BeginRequest += new EventHandler(app_BeginRequest);
            app.EndRequest += new EventHandler(app_EndRequest);
        }
        void app_EndRequest(object sender, EventArgs e)
        {
            //HttpApplication app = (HttpApplication)sender;
        }
        void app_BeginRequest(object sender, EventArgs e)
        {
            string strReturn = "rn";
            HttpApplication app = (HttpApplication)sender;
            string strAddress = app.Request.UserHostAddress;
            string strUrl = app.Request.Url.AbsoluteUri;
            string strQS = app.Request.QueryString.ToString();
            RequestInfo ri = new RequestInfo();
            System.Diagnostics.EventLog.WriteEntry("HttpModule", 
                "IpAddress: " + strAddress + strReturn + "URL:" + strUrl);
            System.Messaging.MessageQueue msq = new MessageQueue(@".private$HttpModuleQueue");
            ri.AbsoluteUri = strUrl;
            ri.IPAddress = strAddress;
            ri.QueryString = strQS;
            msq.Send(ri);
        }

        public void Dispose()
        {
        }
    }
    public class RequestInfo
    {
        public string IPAddress;
        public string AbsoluteUri;
        public string QueryString;
    }
}

Web.config for IIS7:

...................

链接地址: http://www.djcxy.com/p/7608.html

上一篇: 如何压缩数据

下一篇: C#HTTPModule无法加载类型CGI请求