ChannelFactory <T> performance compared to pre-generated proxy using Svcutil

Do Svcutil generated proxies provide better performance than ChannelFactory used at runtime? ChannelFactory default proxy?

I am using .NET 4 with a service that has over 100 operations and over 500 data contracts involved in it.

When I use ChannelFactory<T> , it takes me a lot of time to return the proxy to me. Can anyone suggest which one is the best way to create a proxy?

My code is as follows:

 EndpointAddress endPoint = new EndpointAddress(url); // My own API which gives the custom binding I create programatically CustomBinding binding = BindingFactory.GetCustomBinding("WSECustomBinding"); ChannelFactory<T> factory = new ChannelFactory<T>(binding, endPoint); 
+4
source share
1 answer

When you create code using Svcutil, you get a class that extends ClientBase , which is a wrapper for ChannelFactory .

Svcutil proxies allow you to call the service as methods for objects, and not directly interact with ChannelFactories / Channels, and, in addition, offer additional functions, such as caching channels, but under the hood it is the same engine .

What you are doing is not visible from your code, but do you create a ChannelFactory each time the operation is called? Creating a ChannelFactory is expensive, and you usually cache this instance to use it to open, use, and then close the channels for invoking operations.

For more detailed explanations, see the following pages:

+2
source

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


All Articles