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


Top 5 Contributors of the Month
Easy Web
Imran Ghani
Post New Web Links

Cancel asynchronous WCF call ?

Posted By:      Posted Date: September 16, 2010    Points: 0   Category :WCF
 
In .NET 3.5, is it possible to cancel an asynchronous call to a WCF service ?   The desire is that a user search screen may fire a very long running SQL query in the middle tier, which they then want to cancel. The idea is that the actual database query gets cancelled, not just the WCF call to the middle-tier (otherwise the SQL query is still chewing up resources in the database). Is this possible ?   I'm using the event-based asynchronous pattern that was introduced for WCF in .NET 3.5, which Microsoft are now recommending to be used: http://msdn2.microsoft.com/en-us/library/ms734701.aspx e.g. Code Snippet ... //hook up Completed handler, and call service asynchronously. Use Tab|Tab to auto-generated in VS client.SomeMethodCompleted += new EventHandler<SomeMethodCompletedEventArgs>(client_SomeMethodCompleted); client.SomeMethodAsync(myParam); ...   //Asynchronous result - display in UI. //Completed event handler gets called on UI thread it was created from. void client_SomeMethodCompleted(object sender, SomeMethodCompletedEventArgs e) { //Do something with e.Result; }     Thanks, Andy.


View Complete Post


More Related Resource Links

Asynchronous WCF call seems to be blocking

  
Hi all,I have a Silverlight application that calls a WCF web service which is hosted in an ASP.NET web application. On the client side I call two methods A and B on the service's interface asynchronously; each time a new proxy is created and used to call the respective method. Since the service has its InstanceContextMode set to PerCall, each call should create a new service instance and be independent from the others.For testing purposes I have added a Thread.Sleep(5000) to the implementation of method A.What I expect now is that when the client calls methods A and B one after the other, the service should process both calls in parallel and since method A has the call to Sleep(), method B should return first. Five seconds after that, method A should return as well.For the very first attempt in the web application's lifetime this works as expected, i.e. after rebuilding or performing an iisreset and calling those methods from the client side, it shows the expected behavior explained above. Here's a sample debug dump I received on the client:    Method B, 17:41:23, Server-Thread-ID: 9    Method A, 17:41:28, Server-Thread-ID: 8But after that, when I call those methods again (in exactly the same way), method A seems to block on the server:    Method A, 17:42:43, Server-Thread-ID: 1    Method B, 17:42:44, Serv

How "Call a function" from Message box Ok button and how to add "Cancel button" in Message box

  

Dear Members,

               I have used the following codings to display the message box.

            StringBuilder sb = new StringBuilder();
            sb.Append("<script type = 'text/javascript'>");
            sb.Append("alert('");
            sb.Append(" Do you want save following records...');");
            sb.Append("</script>");
            ClientScript.RegisterStartupScript(this.GetType(), "script", sb.ToString());


              My requirment is to use the "Ok" button in the message box(alert box).

               I have a function Save().

               I mean if i click on the OK button in the message box, then it should call "Save()"  function.

               And also

               I need to add one more button : Cancel in the message box(alert box)

               Please give a hint.            


       &nb

asynchronous call for data population in user control

  

i have a user control in which i want  to populate a drop down on blur event of text box asynchronously.. i tried with page method but it gives error as method is undefined.. then i tried with writing a web service..
and called a web service method in javascript on user control.. this also gives the same error as method is undefined...project is using master pages.. so the script manager is registered in master page..
so i added service reference as



ScriptManager sm = ScriptManager.GetCurrent(this.Page);
            sm.Services.Add(new ServiceReference("../Controls/MeetingTime.asmx"));

in user control...


below is my javascript call..

function getMeetingTime()
    {       
        
       var uclcmbUserId = document.getElementById('<%= uclcmbActiveClients.ClientID %>'+'<%= uclcmbActiveClients.ActualComboId%>');       
        
        try
        {   
        
   &

Problem with asynchronous call to webservice

  

Hello people.

I have a website where i call function in a web service. I am calling it asynchronously. The problem is the data which is returned from webservice is not shown in my label.

See here

protected void Page_Load(object sender, EventArgs e)
{
IAsyncResult asyncResult;

AsyncCallback callback = new AsyncCallback(MyCallBack);
asyncResult = serv.BeginGetImageList(req, callback, null);
}

private void MyCallBack(System.IAsyncResult asyncResult)
{

Label1.Text = "TEST";

}

Very simple but when the page is loaded, the label dont have any text.


Please help.


can any one help me how to use asynchronous call from linq Entity to sql in WPF.

  
can any one help me how to use asynchronous call from linq Entity to sql.
 when i click search i am calling background worker, on the back ground worker
 i want to call asynchronous method with database(because in my database i have too much value)
i am using linq entity frame work.when i click cancel button asynchronous will should stop .
can any one help me

joby James

can any one help me how to use asynchronous call from linq Entity to sql.

  
can any one help me how to use asynchronous call from linq Entity to sql.
 when i click search i am calling background worker, on the back ground worker
 i want to call asynchronous method with database(because in my database i have too much value)
i am using linq entity frame work.when i click cancel button asynchronous will should stop .
can any one help me

joby James

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.

call JavaScript - jQuery code from ASP.NET Server-Side

  
jQuery got so close to me lately that I can see myself adding the scripts to my project almost unconsciously. The thing is, jQuery is very useful for me, in almost all situations and it has been a do or die enhancement for all my project since I first put my hands on it.

Of course while using it, you encounter few situations which need a bit of research to solve, mostly when you are trying to combine it with some other technologies like: UpdatePanels and ASP.NET Ajax. For instance there are many situations when I would like to run some jQuery magic based on some decision that I make on the server side.

ASP.Net Gridview Edit Update Cancel Commands

  
In ASP.Net 2.0, GridView Control also provides the functionality to edit and update the data retrieved from the database using CommandField template. You can cancel the action using Cancel Command of the CommandField. GridView consists of events that can be used to perform the actions like edit, update and cancel upon the Data items displayed in the ASP.Net GridView Data Control.

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.

call JavaScript - jQuery code from ASP.NET Server-Side

  
jQuery got so close to me lately that I can see myself adding the scripts to my project almost unconsciously. The thing is, jQuery is very useful for me, in almost all situations and it has been a do or die enhancement for all my project since I first put my hands on it.

Of course while using it, you encounter few situations which need a bit of research to solve, mostly when you are trying to combine it with some other technologies like: UpdatePanels and ASP.NET Ajax. For instance there are many situations when I would like to run some jQuery magic based on some decision that I make on the server side

How to call an .exe file in .net

  
Sometimes a developer has to call an EXE from another EXE. While calling EXE there can be a requirement to pass parameter.

replacing ok and cancel button of an alert message with YES an NO button in asp.net web application.

  

i want to replace ok and cancel button of an alert message with YES an NO button in asp.net web application.When a user will click yes the data will be saved in the database and if user clicks that will act as a reset button and do not save the data in database and the control will move with as usual to the redirect page.Any pointers will be highly appreciated.I am usin g C# language.


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


Categories: 
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