Closing a WCF connection asynchronously

  • Thread starter Thread starter Norm
  • Start date Start date
N

Norm

Hello,

I have a web page that is getting some data from a WCF webservice. I
have it operating pretty nicely. The connection open is running
asynchronous and it all works. I noticed that the IClientChannel
interface also has a Begin/End close method. My question is: can I
just call BeginClose and trash the IAsyncResult? Will it fail to close
completely when it disposes? Its not really a big deal, I'm just
curious.

Norm
 
Nevermind.

I'll just call close during Page.Unload which wont block the page
being rendered to the client. Much easier.

Norm
 
this is a really, really bad programing practice. you should not be
calling async routines from an aspx page except via the
AddOnPreRenderCompleteAsync method. this is the only supported method.

as long as there is no load on you site you can get away with what you
are doing, but any load and you will start having problems.

-- bruce (sqlwork.com)
 
this is a really, really bad programing practice. you should not be
calling async routines from an aspx page except via the
AddOnPreRenderCompleteAsync method. this is the only supported method.

as long as there is no load on you site you can get away with what you
are doing, but any load and you will start having problems.

-- bruce (sqlwork.com)

Hi Bruce,
I never checked this thread after my second post and I just saw it
now. What is the problem with calling async routines in aspx pages
outside of the AddOnPreRenderCompleteAsync method? What about the
RegisterAsyncTask method? Why would the async methods cause problems
under load? I would appreciate any information you can give me, and if
you have some links to a few whitepapers or something that would be
awesome. I am always striving to not succumb to "really, really bad
programing practice". Thanks in advance.
 
Back
Top