1

I have a WPF desktop application ( .NET 4.0 ) that is talking to an existing asmx service that was written using .NET 2.0
Here is the code we are using to access the service

 Stopwatch s = new System.Diagnostics.Stopwatch();
    s.Start();             
    APMService svc = new APMService();
    UserInfoExtended[] Users = svc.FindAllUsers(LicenseKey);
    s.Stop();
   TimeSpan ts = s.Elapsed;
   string elapsedTime = String.Format("{0:00}:{1:00}:{2:00}.{3:00}",
                     ts.Hours, ts.Minutes, ts.Seconds,
                     ts.Milliseconds / 10);
    MessageBox.Show("WS CALL" + " :  " + elapsedTime);
return Users;

Ok now when I run this code for the first time ( its hooked up to a button click ) it takes about 19 seconds. When I click the button again it takes less than one second. This is 100% repro. What makes this baffling is I wrote a console client against the webservice ( .NET 2.0 ) and it takes less than one second every time. what am I missing here.
Is this a WPF thing? the way it interacts with the (de)serializer for the asmx service . Is the fact that the service is on .NET 2.0 causing an issue.
Any suggestions welcome Thanks

Rahul
  • 2,194
  • 4
  • 31
  • 46

1 Answers1

0

The first thing I'd do is fire up Fiddler to monitor the actual request. This allows you to see if the delay is in the actual call or in the proxy class. If it's in the call, you should look for an explanation within the service. If not, try profiling your code in Visual Studio. It could give you some insight as to where the delay is in code.

Jonathan van de Veen
  • 1,016
  • 13
  • 27