Asp.net 应用程序_BeginRequest未启动(非URL重写)
我想写出SOAP web服务的传入请求。结果表明,我的应用程序\u BeginRequest事件没有触发。它在IIS6和windows2003上运行,因此其他地方建议的配置更改没有任何效果 受保护的无效应用程序\u BeginRequest(对象发送方,事件参数e) { 尝试 { byte[]inputBytes=新字节[HttpContext.Current.Request.ContentLength]Asp.net 应用程序_BeginRequest未启动(非URL重写),asp.net,web-services,httprequest,global-asax,Asp.net,Web Services,Httprequest,Global Asax,我想写出SOAP web服务的传入请求。结果表明,我的应用程序\u BeginRequest事件没有触发。它在IIS6和windows2003上运行,因此其他地方建议的配置更改没有任何效果 受保护的无效应用程序\u BeginRequest(对象发送方,事件参数e) { 尝试 { byte[]inputBytes=新字节[HttpContext.Current.Request.ContentLength] HttpContext.Current.Request.InputStream.P
HttpContext.Current.Request.InputStream.Position = 0;
HttpContext.Current.Request.InputStream.Read(inputBytes, 0, inputBytes.Length);
string requestString = ASCIIEncoding.ASCII.GetString(inputBytes);
Logger.Write("input: " + Convert.ToString(inputBytes.Length), Global.LOGGER_EVENT_SOURCE, 0, 0, TraceEventType.Warning);
using (var writer = new StreamWriter(@"c:\inetpub\wwwroot\requests\testfile - " + DateTime.Now.ToString("MMddYYYYhhmmssffff") + ".xml"))
{
writer.Write(requestString);
writer.Close();
}
// Reset stream pointer to beginning.
HttpContext.Current.Request.InputStream.Position = 0;
}
catch (Exception ex)
{
// Error handling; omitted here.
}
}
如果我只是将代码“几乎”放在正在调用的web服务方法中,则代码“几乎”可以工作;文件已创建,但请求的内容长度为“0”
感谢您的建议。出现此问题的最可能原因是该网站未设置为应用程序。我记得很久以前,“网站”和“web应用程序”之间存在区别,但我认为这已经不存在了。我相信这是一个web应用程序,但我将对此进行研究,因为它不是我在IDE或web服务器上研究过的东西。