.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Asynchronous methods and the AsyncPattern

Posted By:      Posted Date: October 08, 2010    Points: 0   Category :WCF


I have a desktop application communicating with a WCF service that I have implementedand. The desktop client does not use a generated proxy (Add Service Reference or SvcUtil) rather it uses a channel factory with a reference to the WCF Service contract assembly (the contract assmebly is separate to the implementation).

I now need to provide Asynchronous support for the service methods, but I still don't want to use a generated proxy. The only option I see is to extend the Service Contract with operation contracts decorated with the AsyncPattern=true attribute.

I have looked at the msdn example at http://msdn.microsoft.com/en-us/library/ms731177.aspx but I don't see how the asynchronous methods relate to the synchronous method and how much code do I need to write in the implementation of CompletedAsyncResult - having a single string input and output over simplifies the example.

A sample that demonstrates a service with a bit more logic and how to invoke the method using a channel factory on the client without a generated proxy would be very helpful :)


View Complete Post

More Related Resource Links

how to write the wcf asynchronous methods



i am developing the method in wcf as asynchronous but they can't work i am use

    int add(int x,int y);
    [OperationContract(AsyncPattern = true)]
    IAsyncResult Beginadd(int x,int y,AsyncCallback callback,object state);
    int Endadd(int x, int y, IAsyncResult result);

but it will not work if you have any resources plz provide me any link also

The Decorator Pattern & Extension Methods

The decorator pattern provides a formal way to add new functionality to an existing type, without sub-classing. First question: What is wrong with classical inheritance? In and of itself, nothing is wrong with the good old Is-A relationship. It is very common to derive a new class from an existing base class in order to override a few virtual members, and add a pinch of new functionality.

jQuery $(document).ready() and ASP.NET Ajax asynchronous postback

Many call it the ASP.NET jQuery postback problem, but using the technique below should make it no problem anymore. $(document).ready() isn't called after an asynchronous postback. What this means? You lose the functionality that should be executed within $(document).ready() after an UpdatePanel rendered its contents after an asynchronous postback.

Using jQuery to directly call ASP.NET AJAX page methods

Here I am looking to explain how to call page methods using jQuery. Using jQuery to directly call ASP.NET AJAX page methods

jQuery live() and ASP.NET Ajax asynchronous postback

The issue is that normally $(document).ready() is called when the DOM is ready to be manipulated. But this doens't happen after an ASP.NET Ajax asynch postback occurs.

This means that the initial jQuery bindings won't be automatically available after the asynchronous postback is over. I underline "automatically" here because my last post describes more possibilities, how this issue can be worked around.

The Decorator Pattern & Extension Methods

Numerous design patterns exist in the software world today, and ultimately nothing is preventing you from making your own (if people buy into it or not is another question). Furthermore, there is no 'master list' of patterns that all developers agree upon. While this is true, if you pick up any book on the subject, you will find a set of very common patterns most programmers agree are very useful. Many of these patterns were first formalized in the seminal book on the subject, Design Patterns: Elements of Reusable Object-Oriented Software (aka, the Gang of Four [GOF] book; not to be confused with the UK punk band of the same name).

Xml File Methods and Properties

Method and Properties of XmlTextWriter class:
The XmlWriter class is a base class that outputs an XML data structure. It has methods to sequentially write XML elements in a proper hierarchy to create an XML file or other types of output streams. The System.Xml namespace provides support for the XmlWriter. It must be imported to the ASP.NET page with the directive

<%@ Import Namespace="System.Xml" %>

The XmlTextWriter

XmlWriter is an abstract class that is implemented as an extended XMLTextWriter class. The XmlTextWriter writes a sequence of XML nodes one element at a time. Output can be written to an XML file, although other streams of output data can be produced. It can create a new file or overwrite an existing file. Its non-cached writing techniques provides very fast generation of an output stream.

Page Methods and Yahoo UI


Hello people,
I'm constructing an application with Page Methods and YAHOO UI.
I'm Not using Update Panels because Page Methods are faster than Update Panel.

You can post your experiences with this feature of ASP.NET Extensions and vantages of using this type of architecture.

Thanks a lot.

Flávio Malaquias
Asp.Net Senior Developer

Multiple web methods in one transaction


Hi everyone

Sorry I am kinda new in web services, so it may sound a bit newbish question.

We have a web service that comunicates with the database and exposes web methods that enables the application to access the database. Each method does only one operation (Insert, Update or Delete). What I need to do is create a transaction that will be consisted of multiple calls to the database, meaning multiple calls of more then one web methods. Can I do that? (I read that if the web method does not throw exception - or ContextUtil.SetAbort() is not called - the transaction will be commited automatically when the web method finishes executing, which I don't want to happen because I want to call another web method in the same transaction, and then manually commit the transaction)

Thank you in advance.

Cutting Edge: Revisiting Asynchronous ASP.NET Pages


If you need to scale up an existing Web application, you should first look to asynchronous operations, says Dino Esposito. He explains how new features coming in ASP.NET MVC 2 make this easier.

Dino Esposito

MSDN Magazine April 2010

Concurrent Affairs: Solving The Dining Philosophers Problem With Asynchronous Agents


We use the new Asynchronous Agents Library in Visual C++ 2010 to solve the classic Dining Philosophers concurrency problem.

Rick Molloy

MSDN Magazine June 2009

Windows with C++: Asynchronous WinHTTP.


This month's column explains how to use Windows HTTP Services, or WinHTTP, the new, powerful API for implementing HTTP clients.

Kenny Kerr

MSDN Magazine August 2008

.NET Matters: Asynchronous I/O with WebClient


In this month's installment of .NET Matters, columnist Stephen Toub answers reader questions concerning asynchronous I/O .

Stephen Toub

MSDN Magazine July 2008

.NET Matters: Asynchronous Stream Processing


This month Stephen Toub discusses asynchronous stream processing.

Stephen Toub

MSDN Magazine March 2008

Basic Instincts: Extension Methods


This column discusses one of the new features of Visual Basic 2008-Extension Methods. This powerful new feature was introduced to support LINQ. See what extension methods are, how to apply them yourself, and get some great usage tips.

Adrian Spotty Bowles

MSDN Magazine November 2007

Concurrent Affairs: Asynchronous Device Operations


Jeff Richter uses the AsyncResult class to implement the CLR's Asynchronous Programming Model to perform hardware device operations asynchronously.

Jeffrey Richter

MSDN Magazine June 2007

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend