C#HTTPModule无法加载类型CGI请求
尝试使用一个HTTPModule,我在编写的C#类项目中编写日志请求值并扩展第三方CGI购物车。 我的模块可以很好地处理asp,asp.net,jpg和html请求,但是当我请求store.cgi时,我收到以下错误消息。 我是否必须在IIS7中做一些特殊的事情,或者HTTPModule不能与在CGI-BIN中运行的CGI可执行文件一起工作?
'/ cgi-bin'应用程序中的服务器错误。
无法加载类型'IISWatcher.WatchRequests'。 说明:执行当前Web请求期间发生未处理的异常。 请查看堆栈跟踪以获取有关该错误的更多信息以及源代码的位置。
异常详细信息:System.Web.HttpException:无法加载类型“IISWatcher.WatchRequests”。
源代码:
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;
}
}
IIS7的Web.config:
...................
链接地址: http://www.djcxy.com/p/7607.html上一篇: C# HTTPModule Could not load type CGI Request
下一篇: Implementing Paging functionaliteit on a Ajax search based Webcontrol
