Wcf Request Life Cycle

Is there a life cycle that executes WCF requests? In particular, I need to be able to intercept and possibly cancel requests made before they reach the method that was called.

+3
source share
2 answers

You need to implement IDispatchMessageInspector and enter it in the serivce behavior stitch.

use IDispatchMessageInspector.AfterReceiveRequest to accept or reject the request.

see: http://msdn.microsoft.com/en-us/library/system.servicemodel.dispatcher.idispatchmessageinspector.aspx

and

http://www.codeproject.com/KB/WCF/WCFIPfilter.aspx

+6
source

You can write your code in

void Application_BeginRequest(object sender, EventArgs e)
    {
    }

OR

void Application_EndRequest(object sender, EventArgs e)
    {
    }

in global.asax on the server.

+1
source

Source: https://habr.com/ru/post/1716832/


All Articles