Delay in the first WCF service call

4

I am developing an application using WCF to distribute, everything is working quietly, however it has a strange thing, whenever I use the service the first time it takes a lot, (almost a minute for a simple search in the database), however I make a new call to the service gets instant, if I close the application and run again again to delay. Someone the best way to solve this?

    
asked by anonymous 25.03.2015 / 03:14

1 answer

1

The first execution usually takes longer, because when calling WCF for the first time the Channel Factory is instantiated and prepared for communication and this operation consumes considerable resources. From the first call the Channel Factory is stored and the next calls consume less time.

What can be done is to evaluate how the service is being called, if you create an instance of the service with each call or initialization of the application, this will end up causing this discomfort. You can change the way the service is called by hosting the service, or even by creating a (Windows) service to instantiate WCF at the client computer's startup. See this link:

It was discussed this type of problem.

    
25.03.2015 / 19:11