.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

Calling WCF Asynchronously

Posted By:      Posted Date: September 28, 2010    Points: 0   Category :WCF
hi friends,

now,i developed some wcf service in window based project,service will host on window service using net.tcp.for example, my wcf methods are

(i)bool SavePeople(List<People> lstPeople)
(2) List<People> RetrieveAllPeople()

i also make service reference of those on client with "Generate asynchronous operations".And then i call like this

ServiceRef.SaveServiceClient sRef = new IAsynTest.ServiceRef.SaveServiceClient();
bool aa = sRef.SavePeople(listofpeople)
if(aa== true){MessageBox.Show("Success");}else{MessageBox.Show("Fail"}
listofpeople = sRef.RetrieveAllPeople();

Actually is,i want to call my service asynchronously,my questions are
(1)is it correct way to asynchronous and anything i need to implement?
(2)i found some examples like this
bool SavePeople(List<People> lstPeople);
[OperationContractAttribute(AsyncPattern = true)]
IAsyncResult BeginSavePeopleList(List<People> lstPeople,AsyncCallback callback,object asyncState);
bool EndSavePeople(IAsyncResult result);
Any difference between 1 and 2?

Please answer my questions and advise me how should i do?I try to implement like no.2,but,
i m confuse how to do,so i choose no.1,which one is better and if no.2 is

View Complete Post

More Related Resource Links

Calling a Web Service Method Asynchronously does not work in Console Application

I have a web service that has a CreateReport method that generates a report based on the specified criteria. When I call this method Synchronously using a Windows Application or Console Application, the call works fine and the report is created. When I call this method ASynchronously (CreateReportASync) using Windows Application the report is created. When I call this method ASynchronously (CreateReportASync) using Console Application the web service does not even get the call.  I am using VS2005 and .Net Framework 2.0.  So the proxy is automatically created with the Async methods.  I am not really interested the result of the method call, so I do not add a Callback Delegate.  

Calling WF 4 Workflow Service Asynchronously from ASP.NET



I have a developed a workflow service in VS 2010 and added it to my web site as a service reference with the option of 'Generate asynchronous operations' checked.I am now calling the workflow from my asp.net page and everything works fine except that the page will not finish loading until the workflow completes its operations.I have also added the page directive async=true to the top of the page.My workflow service  is just two activities and a 10 seconds delay in the middle, so the second operations will get called after 10 seconds.I have also configured the persistence store from the web.config file.


Here is my code:


ServiceClient svc = new JobWorkflow.ServiceClient();

Thanks in advance.




Windows service calling web services asynchronously.


I have followed the code example from http://msdn.microsoft.com/en-us/magazine/cc163821.aspx#S4 to create a windows service that runs web services at scheduled intervals and have hit some scaleability challenges.

Background and disclaimer.

This is my first attempt at a windows service running scheduled web services, for the most part it has been working fine for months until introducing log running tasks.

OS: Windows Server 2003

.NET Framework 3.5

IIS Version 6

Several of the web services I am calling via the windows service task scheduler are long running, 20-30 minutes in duration, and have caused me to fight through a myriad of timeout issues

Calling a data-driven web service method asynchronously


I am trying to write a Windows Service which will call web service methods based on a run schedule.  I have setup a ‘schedule’ table which holds the name of the web service method and some scheduling details (e.g. run every day at 0200).  I am using VS 2005/vb.net.

My service creates a timer which runs every minute and when the timer is fired the schedule table is read and  any entries which are due to fire are actioned.  This could mean multiple methods being fired at the same time.  As some of the methods are overnight batch processes and may take some time, I don’t want processes to wait for others to finish before being actioned.  As the methods themselves write to the system log to report their success or failure the scheduling service does not care whether the job fails or not – it is simply doing a ‘fire and forget’ exercise.

What I need is some code which will fire a data-driven web service method asynchronously.

I have investigated two types of method call.  The first is a simple InvokeMethod:-

mywebservice.GetType().InvokeMember(ScheduleRow("WebMethod").TOString(),(Reflection.BindingFlags.InvokeMethod Or Reflection.BindingFlags.IgnoreReturn), Nothing, mywebservice, Nothing)

The second is an asynchronous call:-

Dim asyncCall as New AsyncCallB

Calling webservice from the server


I have a sample web service and aspx file. I deployed them to an existing website that contains classic asp files.

web-service: --- using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Services; [WebService(Namespace = "http://localhost/MyWebServices/")] public class MembershipRegisWebService : System.Web.Services.WebService { public MembershipRegisWebService () { //Uncomment the following line if using designed components //InitializeComponent(); } [WebMethod] public string HelloWorld() { return "Hello World."; } }

aspx.cs file: --- using System; using System.Collections.Generic; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.Services; public partial class CallWebService : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { MembershipRegisWebService mrWs = new MembershipRegisWebService(); Response.Write("Calling web service:" + mrWs.HelloWorld()); } }

It runs locally, but it shows an error when running it from the server:

Server Error in '/' Application. Compilation Error Description: An error occurred during the compilation of a resource required to service this request. Please review the follow

Advanced Basics: Calling All Operators


This month I found an interesting question in my mailbag. It went something like this: "I am writing some code working with points and other drawing objects in Visual Basic® 2003, and I just want to add an offset to a point, effectively moving the point.

Ken Getz

MSDN Magazine December 2004

way of calling "javascript function of parent window from child window."

The article way of calling "javascript function of parent window from child window." was added by raja.s on Sunday, June 06, 2010.

Hi,Here i am going to explain how to call the javascript function of a parent window from the child window(pop-Up).Some may know before reading this post.Parent Java Script Function:script language="Javascript" type="text/javascript">

Total newbie question: Calling jQuery in an UpdatePanel?



Please forgive this ignorant question - I've used ASP.NET AJAX a good deal but I'm new to jQuery.  Specifically, is it possible to call or create jQuery events on the fly via an UpdatePanel?  For example, calling a jQuery modal or animating a Label (or <div> contained Literal), etc.

If anyone has any advice or could point me to some easy tutorials on mixing ASP.NET AJAX and jQuery, I'd greatly appreciate it. 



Calling parameterized method from aspx file


Hi all,
I have following method
 public string GetYoutubeVideo (string code)
        return "asasdasfa"

Calling Web Services


Dear Friends,

I m new to web services.I want to create and call the web service on click of button which wold give me city id and cityname.Then I want to bind it to the Dropdownlist1 

How shold i to it




Calling a webservice in MVC using jquery works on dev box not prod box


I have a webservice that is part of the MVC project.  I am using VS 2010 MVC 2.0 on Windows 7.  When I run the web application locally the webservice call works flawlessly, however on the prod box using  2008 upgraded with asp.net 4.0 it fails.

I get an error "The controller for path '/services/traxservices.aspx/upDateCustomer' was not found or does not implement IController. "

Is there some type of issue with the settings in the global.ascx or in IIS that I am missing?


Any help would be appreciated.

Example of calling AuthenticationService from javascript ...??


I have a plain html page (no asp.net form) and want to login (wcf rest,  json) via this form. I created an Authentication.svc, modified my web.config and try to authenticate via javascript. When running my page and trying to login I get a 500 error. Please find my code snippet hereunder. Can someone please give me a clue as what I'm doing wrong? Thanks.



 // Define global variables.       
        var username;
        var password;
        function pageLoad() {
            username = $get("txtUser");
            password = $get("txtPassword");
            buttonLogin = $get("ButtonLogin");
            buttonLogout = $get("ButtonLogout");

http module calling order


Our site uses urlRewriter http module that does the url rewriting for us.

I want to create another http module that will handle our customize URL redirects. Now I want this new customize http module to be call before the UrlRewriter module (to avoid page not found messages the UrlRewriter generates). Is there a way we can contol the calling order ?

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