WCF service starts up takes 10 seconds with a big service contract having 1000 methods

I'm using a named-pipe WCF service, which has about 1000 methods (yes, I know it's not a good practice, but it's life...).

The problem I got is that when starting up the WCF service, it costs about 10 seconds on constructor of ServiceHost class. By tracking into it, I found the time is spent on preparing service description (InitializeDescription method of ServiceHostBase class). I guess it's because there are too many methods defined in this service contract.

Anyone can help to answer how can I speed up the start up time of this big service contract?

I know it's not a good practice to define so many methods in one service contract. But I can't change the service contract (such as divide it to several smaller ones). You know, this is the real life...

Thanks.

Answers


Refactoring this endpoint, while non-trivial, is probably fairly easy to do if you manage the process properly:

  1. Pick a single logical business case which your endpoint currently supports.
  2. Create a list of all the operations needed to fulfil this single logical business operation.
  3. Create a new endpoint for just those operations, keeping the same operation signatures.
  4. Re-point any existing consumers who want to fulfil this business case to the new endpoint.
  5. Repeat process until you have covered all business cases.

Apologies this does not address original question directly and appreciate re-working on this scale may be outside the scope of your current development.


Need Your Help

What is the best way to store a unique URL Slug?

database url slug

I'm trying to generate some url 'slugs' for my website. It's based upon a single piece of user generated text.