How to increase the startup performance of WCF proxies?

Recently I encountered a performance issue in my client code. I have many data contracts in my WCF layer. Each and every time I create a proxy object, the csc.exe runs on the background and taking 100% cpu time. Then I noticed that csc.exe (C# compiler) compiles my proxy dll, every time I create the proxy object. To avoid this and increase the start-up performance in this scenario, Use the SVCUtil.exe and generate the pre-compiled serializer dll for the proxy dll. Make sure that the pre-compiled serializer dll has <yourassemblyname>.XmlSerializers.dll format.

svcutil /t:xmlSerializer MyWCFProxy.dll"
csc /t:library MyWCFProxy.cs /out:MyWCFProxy.XmlSerializers.dll

No comments:

Post a Comment