English 中文(简体)
周转基金:检查交换的大小
原标题:WCF : Check the exchanged size

为了制定某些周转基金基准,我需要有一个方法来获得交换数据(所有信头(甚至TCP)/压缩/...)的大小。

它在一个更大的基准中(它也尝试不同的绑定、编码、...), 所以我需要用程序来做它,

有钩子的地方这样做吗?

所有频道/装订器/编码器都是以程序方式创建的,以使一些测试自动化。

我找到一些方法(),但是我不确定它会使用非文本数据。或者 < a href="http://zamd.net/2008/08/15/calculating-wcf-mesage-size-size/ a >, http://zamd.net/2008/08/15/calculating-wcf-message-sisize/ a >,但我不知道它会如何启动它会与我的客户编码连接。

最佳回答
问题回答

您有两个选项 :

  • use WCF extensibility. this will typically be more work, and you will need to consider various wcf situations.
  • use out of band solution like wireshark

I m not sure why you prefer the former - I recommend to try wireshark, I m sure it can be automated too. Anyway if you want to do this inside wcf you should implement a custom message encoder to calaulate the size of bytes that go on the wire. this would need to be a generic encoder that wraps any other encoder inside it. here is an example for a generic encoder. note that the encoder approach will only consider the message size, but not any framing on top of it (HTTP headers for example). This is why I think wireshark is better for your case.





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签