2

There's some good examples here and here using Task, await, etc but I have to run under .NET 3.5 (due to some libraries we need that are 2.0). And this example seems to be synchronous for kicking off getting the response.

I need to push some XML up to the server and get back XML in the response, so I think that's a POST, but how best to do this in a way that is fully asynchronous, under .NET 3.5?

thanks - dave

Community
  • 1
  • 1
David Thielen
  • 28,723
  • 34
  • 119
  • 193
  • What kind of app are you building? WPF? Webforms? Windows forms? Service?.. just asking to be able to build a full example. – Faris Zacina Sep 22 '14 at 16:16
  • @DoubleScorpio This is in an Exchange TransportAgent, basically a DLL that Exchange loads & calls. Probably the best known example would be a command line app or a service - because there's no UI, etc. – David Thielen Sep 22 '14 at 16:33
  • `I have to run under .NET 3.5 (due to some libraries we need that are 2.0).` The .NET Framework [supports side-by-side execution](http://msdn.microsoft.com/en-us/library/8477k21c(v=vs.110).aspx). So you should be able to use your 2.0 libraries in conjunction with whatever .NET version you wish. – Reg Edit Sep 22 '14 at 17:43
  • The example at http://msdn.microsoft.com/en-us/library/86wf6409%28v=vs.90%29.aspx is a good one. You just need to get rid of the ManualResetEvent since you have an app that will not exit after execution (like in their example), and you don't need to block/wait for the result. In the ReadCallBack you have the result in strContent and at that point you can invoke some operation to utilize the result (e.g. write the result in a DB, Queue etc.). Not sure how you want to utilize the result exactly. – Faris Zacina Sep 22 '14 at 17:47

0 Answers0