function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Dennis BakerDennis Baker 

Instantiating the Salesforce Service object to use the API for the first time in a session takes approximately 15 seconds. Is there any way to reduce this time?

We have a .NET application that connects to salesforce via SOAP and uses the API for creating/updating objects.

We noticed the initial instantiation of a new Salesforce Service object for a new session takes approximately 15 seconds.  

Has anyone else come across this issue and/or found a way to reduce this time significantly?

We currently use the Enterprise WSDL and I'm looking into downloading the Partner WSDL to see if this is what we should be using, but I wanted to check with the forum in case others have come across this issue.

Any help would be appreciated.  Thanks.
Best Answer chosen by Dennis Baker
Daniel BallingerDaniel Ballinger
The first call being slow with WCF is documented in Accessing Force.com SOAP Endpoints with .NET (https://developer.salesforce.com/blogs/developer-relations/2014/09/accessing-force-com-soap-endpoints-net.html) and Why is the first WCF client call slow? (http://stackoverflow.com/q/10859832/54026)

If you don't want to switch to using a Web Reference have a look at How to: Improve the Startup Time of WCF Client Applications using the XmlSerializer (https://msdn.microsoft.com/en-us/library/aa751883(v=vs.110).aspx)

All Answers

Daniel BallingerDaniel Ballinger
The first call being slow with WCF is documented in Accessing Force.com SOAP Endpoints with .NET (https://developer.salesforce.com/blogs/developer-relations/2014/09/accessing-force-com-soap-endpoints-net.html) and Why is the first WCF client call slow? (http://stackoverflow.com/q/10859832/54026)

If you don't want to switch to using a Web Reference have a look at How to: Improve the Startup Time of WCF Client Applications using the XmlSerializer (https://msdn.microsoft.com/en-us/library/aa751883(v=vs.110).aspx)
This was selected as the best answer
Dennis BakerDennis Baker
Thank you or your response Daniel.

I'm reviewing the links you supplied.  In particular the XmlSerializer option - this may be the one that helps our current environment.  

We are using the Salesforce object as a Web Reference in our application.
Daniel BallingerDaniel Ballinger
You might also find the article Accessing Force.com SOAP Endpoints with .NET (https://developer.salesforce.com/blogs/developer-relations/2014/09/accessing-force-com-soap-endpoints-net.html) useful. There are further notes about Service Reference performance there.

If you are using a Web Reference, ensure you have compression enabled.