Getting "on the wire" Message Size in WCF

While I am making SOAP or REST calls for WCF, I would like the channel stack at both ends (client and server) to record the wired size of the received data. Therefore, I assume that I need to add custom behavior to the channel stack on both sides. That is, on the server side, I wrote down the advertised size of the IP header that was received (cumulatively until all packets for this message were received). On the client side, I would write down the advertised size of the IP header that was returned from the server (the same summation process).

But this suggests that this information is visible to the WCF user behavior at the channel stack level. Perhaps this is visible only at the ASP.NET level (at the level under WCF)? Or maybe WCF is already collecting this “total message size” information, and can I just access the property?

In short, does anyone have a further understanding of whether this information is available and how it is available? I must confirm that "size" data will be collected in the production environment as part of the usual business logic calls. Therefore, I am not interested in the proposed solutions .

This question is related to the previous bandwidth issue .

+3
source share
3 answers

I think that the only place where you could get this information (or as close to it as possible) would be with the help of MessageEncoder which wrapped one of the system and wrote down this information.

It would not be very difficult for me to do this, but it would be very unpleasant if you needed to use special bindings for this, I think (or maybe there is a way to connect it using behavior, I'm not sure).

It may be worth noting that this still does not take into account some data, such as HTTP headers, and those that are sent by transport, but are not actually part of the message itself.

+1
source

WCF , svclog WCF HTTP- :

alt text

+7

, Fiddler. , .

,

, - , . . , .. .

0
source

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


All Articles