views:

38

answers:

1

I have a strange little issue with a WCF RIA service I'm using in a SL4 application. Here is the code for a button click handler I've got:

    private void btnTest_Click(object sender, RoutedEventArgs e)
    {
        LanguageContext context = new LanguageContext();
        LoadOperation<Language> op = context.Load(context.GetLanguagesQuery());

        op.Completed += (obj, args) =>
            {
                if (!op.HasError)
                {
                    System.Threading.Thread.Sleep(500);
                    MessageBox.Show(context.Languages.FirstOrDefault().DisplayName);
                }
            };
    }

Note that there's a Sleep call in the handler. Without that sleep call, I get an exception (A transport-level error has occurred when sending the request to the server. (provider: Shared Memory Provider, error: 0 - No process is on the other end of the pipe.)). If this code is in the "Completed" handler, I figured it was actually, well, completed by the time it got there. Why does it die without the Sleep()? BTW, the Sleep() isn't an option for production, it was just a problem-sovling tool :)

A: 

So, If I add "pooling=false" to my connection string, everything works. However, I don't really like that answer. Connection pooling is a good thing. Is there a way to leave it on and have things still work?

David Moye
I guess I have to use pooling=false. I haven't found any other approach.
David Moye

related questions