How does one get the method name from a WCF Request in Application_BeginRequest?

Someone asked on Stack Overflow:

I’m hosting WCF in an IIS, in my HttpApplication I’d like to get the WCF operation contract name (method being called) in the Application_BeginRequest method:

protected void Application_BeginRequest(object sender, EventArgs e)
{
    var request = Context.Request;
}

I get the request from the context but I’m unable to understand how to find the name of the WCF method that was called.

I posted the following answer, which was chosen as the accepted answer:

Check out the incoming HTTP Headers:

Console.WriteLine(HttpContext.Current.Request.Headers["SOAPAction"]);

This will spit out the full value, in my sample that was:

http://tempuri.org/IService1/DoWork

It is probably worth noting, but OperationContext.Current.IncomingMessageHeaders.Action won’t work in Application_BeginRequest because the operation hasn’t started yet, so OperationContext.Current is null.


Originally posted on Stack Overflow — 0 upvotes (accepted answer). Licensed under CC BY-SA.

signed letter b

Dad. Geek. Gamer. Software developer. Cloud user. Old Car enthusiast.  Blogger.


Top Posts


profile for Nate on Stack Exchange, a network of free, community-driven Q&A sites
a proud member of the blue team of 512KB club
Thoughts, opinions, and ideas shared here are my own. © 2026 Nate Bross.