I have a web service (not a WCF service) hosted under IIS 7, the web service has two methods: method1, and method2.
I am looking to differentiate between the requests for method1, versus the requests for method2, without modifying the web service code.
Under the IIS 7 logs, I can see the requests to the web service, the web service URL gets logged under the "cs-uri-stem" field, but the "cs-uri-query" field is empty.
Is there anyway to log the requests for the web service methods, without modifying the web service code?
You can log all incoming request inside various methods of the processing pipeline. For example, add a handler for BeginRequest
in your Global.asax
:
Application_BeginRequest( object sender, EventArgs e )
{
HttpApplication app = (HttpApplication)sender;
HttpContext ctx = app.Context;
var requestUrl = ctx.Request.Url;
// the uri should be of a form:
// http://yoursite/theservice.asmx/MethodName
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With