.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 a Web Service Method Asynchronously does not work in Console Application

Posted By:      Posted Date: September 16, 2010    Points: 0   Category :ASP.Net
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.  

View Complete Post

More Related Resource Links

Console Application Calling Web Service


Hi there!

I am getting an error when i late bind the web service reference depending on environment from a Console Application. I am getting the following error:

Public member 'Update' on type 'XYZService' not found.


I made sure that i am using the latest references and also the Update Method has been published in test, dev and staging environments.


Any help on this would be greatly appreciated.I am getting this using the production reference also.



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 WCF service Method in HTTP GET by browser or ASP.NET ( like HttpWebRequest for example)

Can i call a WCF service Method using HTTP GET by browser or ASP.NET (without WCF Client)? it can be done with asmx web service.... but i can't find a way to call a WCF service Method with HTTP GET through the browser or C# ASP.NET Code... can i do that ?

PUT method gives error 400 "Bad Request" in WCF REST Service Application

I am trying to learn WCF REST Services through http://blogs.msdn.com/endpoint/archive/2010/01/14/updating-state-in-wcf-webhttp-services.aspx , It's a link of Part 3 of 12 part blog series. Now I am trying the same stuff given in the part 3 with my own Entities and Entity Model instead of what is given in the blog. Here is my full project I am working on .. http://cid-9e3f62c0688824b0.skydrive.live.com/self.aspx/.Public/pronerveEPMS.zip For comparision with the code shown in the Blog I am following, you can download the zip file of the project from the same link given here at starting (At the end of the blog and before comments starts). And here is the method in Program.cs file of console project in my application that raises the exception.....        private static Role UpdateRole(HttpClient hc, Role role1)        {            Console.WriteLine("Updating Role {0} : ",     role1.RoleID);            Console.WriteLine();            string updateURI = "Roles/" + role1.RoleID.ToString();            HttpContent content = HttpContentExtensions.CreateDataContract(role1);            using (HttpResponseMessage response = hc.Put(upd

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.




When i Add service Reference in console application, I was not able to connect the page?



when i  add http://abcdef/webservice.svc in service reference , I got the following errors


The document at the url http://staging.syncfusion.com/SyncfusionService/WebsiteService.svc was not recognized as a known document type.
The error message from each known type may help you fix the problem:
- Report from 'DISCO Document' is 'There was an error downloading 'http://26128-staging/SyncfusionService/WebsiteService.svc?disco'.'.
  - The remote name could not be resolved: '26128-staging'
- Report from 'http://staging.syncfusion.com/SyncfusionService/WebsiteService.svc' is 'The document format is not recognized (the content type is 'text/html; charset=UTF-8').'.
- Report from 'WSDL Document' is 'The document format is not recognized (the content type is 'text/html; charset=UTF-8').'.
- Report from 'XML Schema' is 'The document format is not recognized (the content type is 'text/html; charset=UTF-8').'.
Metadata contains a reference that cannot be resolved: 'http://staging.syncfusion.com/SyncfusionService/WebsiteService.svc'.
The remote server returned an unexpected response: (417) Expectation failed.
The remote server returned an error: (417) Expectation failed.
If the service is defined in the current solution, try building the solution and adding the service

Consume the Siebel On Demand web service in .Net console application.



I have Siebel On demand web service wsdl, I want to consume Siebel OD web service in my .Net console application.

I want to update Siebel On Demand picklist(Table) from .Net client

I can implement this from below 2 ways.

1. Add web reference and VS will automatically create proxy class.

2. Dynamically create input soap message and pass soap message across with help web service extension’s webrequest and webresponse methods.

Please advice which one of above process will be good in performance, scalability of client, lightness of invocation of web service.

 And also let me know other way for performance enhance

Cannot get user profile service application to work using the guide on harbar.net?



I'm hoping someone on here can help with this, as I've really been round the houses with this.

Anyway I've attempted to provision the UPS Service App probably 4 times now, each time learning more and more about the common problems.

The last time, I rolled my VM back to just after the installation of SharePoint 2010 binaries, and then ran the PCW and created the farm again from scratch.

I then followed this guide: http://www.harbar.net/articles/sp2010ups.aspx

Everything seemed to work perfectly well, after provisioning UPS I did a couple of iisresets as welll as execadmsvcjobs until I could see the timer job that provisions the FIM services.

These services came up and the following errors were reported in the event log:


The first one is lies, I did start the service and verified it was running, anyway for completeness:

"There are no instances of the User Profile Service started on any server in this farm. Ensure that at least one instance is started on an application server in the farm using the Services on Server page in Central Administration."

This one I have seen constantly on my Farm through various builds:

"An exception occurred when trying to issue security token: An error occurred while receiving t

Web Service - Different Operation Contracts calling the same method

I would like to know how could I define two operation contracts (JSON, XML) which call to the same method; I have defined web and basic http bindings for all the Operation Contracts in the way that they could be called from HTTP requests (jQuery) and from Silverlight.

This first example works because the methods have different number of input parameters. But I need to add the attribute name to the Operation Contract.

        [WebInvoke(Method = "POST",
            UriTemplate = "1/json/getRegions",
            ResponseFormat = WebMessageFormat.Json)]
        RegionListOutput GetRegionList(int countryID, int other);

        [OperationContract(Name = "getRegionsXML")]
        [WebInvoke(Method = "POST",
            UriTemplate = "1/xml/getRegions",
            ResponseFormat = WebMessageFormat.Xml)]
        RegionListOutput GetRegionList(int countryID);


SoapException when calling web service method.


Hi all,

I am stuck with this for a 2 days now. I have referenced 3rd party web service in my project. I am programmatically setting credentials to the service. Within debug it shows the dialogue box when calling web service method saying, Also within the debug it says,

Unable to automatically step into the server. Connecting to the server machine 'domain' failed. Invalid access to memory location.

And when I step out of the code it catches, System.Web.Services.Protocols.SoapException.

I did a Response.Write on all properties of this SoapException and got this string.

MESSAGE: Internal Error, CODE: http://schemas.xmlsoap.org/soap/envelope/:Server, DETAIL: System.Xml.XmlElement, NODE: , HELPLINK: , ROLE: , ACTOR: , INNEREXCEPTION: , IP: ::1

It returns Internal Error with no error code and I am stuck as what possibly I am doing wrong that is causing this exception. I am unable to check the resulting Xml generated behind the scene becuase it is not logged on the server web service is hosted on. Or if there is a way to fetch Xml when I call method on service, let me know. Thanks.

Please help me solving this horrific problem...

web service method doesn't work


DEar all,


I have developed a asp.net website in visual studio 2008, I have Sharepoint server 2010 installed n configured.

In my asp.net website I have a function which will create a folder in the sharepoint site.

My problem is when I have published the website, the folder is not being created.

But when i am debugging it, the folder is being created in the sharepoint site.

My Code is as follows:



String CreateFolder(string sfolderName)



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

Using synchronous web service method "asynchronously"


Hello, I have a web form that submits user data to a database, then submits the same data to a web service via a method that is only available as synchronous.  It can take a while to run, and there's no reason for a user to wait for it (it's already in the database).  I'm wondering about possible solutions.  One approach I though of would be to add the request to MSMQ and create a windows service to listen for new messages, then call the web service.  I'm wondering if it's also possible to use global.asx or an httpModule, since they opperate at the application level (not too familiar with either one though).  Any suggestions, or anyone have another approach that might work?

why doesnt System.Drawing work on Console Application?


hi all

i wanna do a project with openGL in console application.but System.Drawing doesnt work.what must i do?i'm waiting for ur replies.

Calling a WCF Self Hosted Console Application

How to consume a WCF Self hosted Console application? | Calling a Self Hosted WCF Service.

Convert WCF service to self hosting application


 I created project as a  WCF Service application and now according to recuriment that needs to be converted as a self hosting application

How can i do this?

Converting WCF service app to Self hosting app?

problem in consuming WCF service through Window application


I have a silverlight application and WCF service all made in VS 2010 , i had hosted my site to web server which contain Window 2008 and IIS 7.0

now the problem is i have another application which is a window application developed in VS2008 , when i try to add the service reference it gives me error


The document at the url was not recognized as a known document type.

The error message from each known type may help you fix the problem:

- Report from 'DISCO Document' is 'There was an error downloading 'http://dev_qa.emspa.com/HRDev3/Service.svc?disco'.'.

  - The request failed with HTTP status 400: Bad Request.

- Report from 'WSDL Document' is 'The document format is not recognized (the content type is 'text/html; charset=UTF-8').'.

- Report from '' is 'The document format is not recognized (the content type is 'text/html; charset=UTF-8').'.

- Report from 'XML Schema' is 'The document format is not recognized (the content type is 'text/html; charset=UTF-8').'.

Metadata contains a reference that cannot be resolved: ''.

Content Type application/soap+xml; charset

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