是否存在WCF请求通过的生命周期?具体来说,我需要能够拦截并可能取消在调用之前所做的请求。
答案 0 :(得分:6)
您需要实现IDispatchMessageInspector并将其注入serivce行为堆栈。
使用IDispatchMessageInspector.AfterReceiveRequest接受或拒绝请求。
和
答案 1 :(得分:1)
您可以在
中编写代码void Application_BeginRequest(object sender, EventArgs e)
{
}
OR
void Application_EndRequest(object sender, EventArgs e)
{
}
服务器端的global.asax中的事件。