Using WCF CloseAsync in silverlight

Is this the right approach to close WCF connections in silverlight?

ServiceClient client = new ServiceClient();

        client.MakeRequestCompleted += (sender, e) =>
            {
                client.CloseAsync();

                //some implementation goes here
            };

        for (int i = 0; i < 1000; i++)
        {
            client.MakeRequestAsync();
        }

I am having problems with parallel connections, when the loop reaches the point where it is about 300 requests, it just fails. Thank.

+3
source share
2 answers

I am not an expert, but I studied a similar problem and no one else answered ...

You close your client without guaranteeing your work to complete 1000 web service calls. It was also difficult for me to find the documentation on the method CloseAsync, but the accepted wisdom seems to call CloseAsyncafter you made all your web service calls.

, - - , , , .

0

, : http://forums.silverlight.net/forums/p/29299/95656.aspx


1: ServiceClient client = new ServiceClient();
2: client.MakeRequestCompleted += (sender, e) =>...
3: client.MakeRequestAsync();

MakeRequestCompleted . .

1 2, , . , . [1]

1, , .

, , , ?

for (int i = 0; i < 1000; i++)
{
    ServiceClient client = new ServiceClient();
    client.MakeRequestCompleted += (sender, e) =>...
    client.MakeRequestAsync();
} 

(, , .)


[1]: , "hammer-client", , - , .

0

Source: https://habr.com/ru/post/1763771/


All Articles