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

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

A lengthy operation in an ASP.NET web service

Posted By:      Posted Date: August 21, 2010    Points: 0   Category :ASP.Net

I've built an ASP.NET web service with .NET 2.0 (an asmx file). I invoke a web service method using Ajax. The method takes a substantial amount of time to execute (5 minutes to 1 hour). I believe it's not a good idea to "hang" the web request for so long.
I'm wondering if the web service method could spawn an additional process which in turn would execute the lengthy operation and notify the web service once the operation is completed.
Are there any good practices regarding this kind of functionality?


View Complete Post

More Related Resource Links

CRUD Operation should be Part of BO or Service/Manager Classes?



I am developing an application which has a general structure similar to what Scott has described at http://nhibernateasp.codeplex.com

Thanks to Scott for developing such a nice architecture which can be used for most of the projects!

It uses Service Layer which contains service classes (like Product Service) which actually talk to the repository layer (ProductRepository) and these service classes are responsible for CRUD operations while the BO (Product) contains just the data and the validation methods.

As I have read, in OO design, you should design a class which contain both data and behavior, in which case, the BO (Product) should be responsible for doing its own CRUD and it should not be a responsibility of Service classes.

Which approach you think is better design and what could be the reasons?

Any help is this regard is appreiciated.




Service Operation - Get proper data when browsing the service, but not when calling the service from

Hello, I recently implemented a service operation in an attempt to pass some filter parameters to a data service (a user guid and an organization, actually, for impersonation of a user on the service's call to the application). I successfully added the service operation to the data service, and I can browse the service and see the data filtered as I expected. However, when I call the service operation from the Silverlight client, I don't get any results, even though I should. Am I missing something? Code below if it's helpful. Thanks! Service Operation Definition: [WebGet] public IEnumerable<opportunity> filteredopps(string userid, string org) { /*Define the connection with the impersonated user*/ CrmConnection crmc = CrmConnection.Parse("Authentication Type=Passport; Server=https://" + org + ".crm.dynamics.com/" + org + "; User ID=myuser; Password=mypassword; Device ID=mydeviceid; Device Password=mydevicepassword"); crmc.ImpersonatedUser = new Guid(userid); var crmOnline = new DataContext(crmc); List<opportunity> uplist = new List<opportunity>(); crmOnline.UsingService(service => { var query = from o in crmOnline.opportunityopportunities select o; foreach (opportunity thisopp in query) { uplist.Add(thisopp);

Service Operation with Joins between entities

Hello, I have a service operation that queries multiple entities in a data source using joins. However, I can't seem to get to the joined entity, either when browsing the data service in IE, or when consuming the data service in the silverlight client code. With this code in the data service operation method: var query = from o in crmOnline.opportunityopportunities join su in crmOnline.systemusers on o.ownerid.Value equals su.systemuserid select o; Should I not be able to view the data service in a browser and see the systemusers like this (the service operation takes two arguments, userid and org): http://localhost:6246/convoservice.svc/filteredresults?userid='22222222-f3sw-aahh-hy65-nn88dd3333ee'&org='testorg'/systemusers or to consume it in the client like this foreach (opportunity opp in response) { string name = opp.name; string ownername = opp.opportunity_owning_user.fullname; ... ? In either scenario, I'm not having success. When browsing the URL posted above, I get an http 400 "webpage cannot be found" error. I get a null reference exception in the client. Any help would be greatly appreciated! Web: http://invoc.net

Long Running Service Operation & WCF



I have a requirement where in my service operation is going to be long running process. I dont want to rely on typical duplex call back mechanism cos these service may be used in non wcf technologies as well. can anyone suggest best practices, approach, alternative to achieve the same

Many thanks


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);


How to setup a ReceiveReply activity to receive the result of a WCF service operation?


I already figured out what I have to do to send a WCF message to a WCF service developed with .NET, but I could not get the result back to the workflow. I need to know what I have to do to get that result. 

I have a very simple test WCF service with following contract:

[ServiceContract(Namespace = http://www.juergen-bayer.net/samples/wcf)]
public interface IDemoService
  long Add(int value1, int value2);

The client application uses a workflow with a Send and a ReceiveReply activity. The WCF endpoint is configured in the config file:

   name="BasicHttpBinding_IDemoService" />

The Send activity is configured like follows:

Action="http://www.juergen-bayer.net/samples/wcf/IDemoService/Add" => This would also be the default value in my case

The parameters of the WCF message are placed in the content: 


Getting Error When Calling Wrokflow Service - The operation could not be performed because WorkflowI


The scenario .  ..

I have developed a Custom Activity(CA) which has a designer like SEQUENCE.

I created a Workflow Service (XAMLX) and placed my Custom Activity(CA) as the first activity. Then I placed a RECEIVE activity within this CA and provided all the necessary details.

Now if I run the workflow service and call the service operation it is throwing execption.

Failed to invoke the service. Possible causes: The service is offline or inaccessible; the client-side configuration does not match the proxy; the existing proxy is invalid. Refer to the stack trace for more detail. You can try to recover by starting a new proxy, restoring to default configuration, or refreshing the service.

The operation could not be performed because WorkflowInstance 'a74eb5e2-72b4-4cb1-8a4d-daed6f431936' has completed.

Instead if I put the original SEQUENCE activity as first activity and then placed a RECEIVE activity it is working good. But I don't want to use SEQUENCE activity here . .. . I need my custom SEQUENCE like activity to be the first activity and make this as a place holder for other activities.

Please help to get out of these errors.


System.ServiceModel.FaultException: Operation is not currently available on the service.


We have a sequential activity with multiple receive activities. When we call Receive Activity from WCF getting the following error

System.ServiceModel.FaultException: Operation is not currently available on the service.

WCF is hosted in IIS with domain account

WF is hosted in Self host running in the same domain account in which WCF is hosted.

Any idea why this error is coming? But when we run everything in VS 2008 (hosted in develpment server) ,everything is working fine






Consume WCF Data Service Operation from WF4 workflow




I've set up a WCF Data Service with a couple of operations. I've marked the operations with [WebGet] but im not able to get them in my toolbox in Visual Studio when i add a service reference. What are the steps that i need to go through to do this?

When I try to add it as a reference from my workflow project I get "No operations found"


Windows Service Applications Tutorials

You can easily create services by creating an application that is installed as a service. For example, suppose you want to monitor performance counter data and react to threshold values. You could write a Windows Service application that listens to the performance counter data, deploy the application, and begin collecting and analyzing data.

WCF Tip: Using Properties in Service Contracts

you'll notice all of the Service Contracts are implemented with interfaces containing only methods. For the longest time I thought that's all that was supported, until I thought about it a little more. In C# land, properties are simply wrappers around a get method and set method, so why wouldn't we be able to use properties in a service contract? Well the answer is we can.

Realizing a Service-Oriented Architecture with .NET

This article is meant to be a practical discussion guide to building a .NET application in a service-oriented architecture. We will consider real-world goals, real-world obstacles, and experience-based solutions. I quickly concede the approaches discussed here are not exhaustive or infallible. This paper is focused on application development, not application integration. We will specifically consider architectural issues and component design issues.

The Potential of Web Services

Web Service for uploading documents into SharePoint

WS UploadService is a web service written for Microsoft Office SharePoint Server 2007 and Windows SharePoint Services 3.0 and is meant for uploading documents into SharePoint. I have just uploaded the zip file to GotDotNet.com so it will take some time before the zip file appears in the list of downloads. For the time being, you can download the zip file from the following location

Creating and Using an ASP.NET Web Service in Visual Web Developer

In addition to letting you create Web pages, Microsoft Visual Studio also lets you create Web services that use ASP.NET XML. Creating a Web service in Visual Studio is similar to creating a Web page. You can also use the Microsoft Visual Web Developer Web development tool to reference and use Web services that are in a Visual Web Developer solution, on your local computer or in a local or external UDDI directory. In this walkthrough, you will create the Web service in one solution and use it in another.

Tasks illustrated in this walkthrough include:

Creating a simple XML Web service in Visual Web Developer.

Creating a separate Web site that uses the Web service.

AutoGenerateSelectButton="False" ignored when using Domain Service


Crosspost from RIA Services forum: http://forums.silverlight.net/forums/t/196466.aspx

I'm creating a Dynamic Data application in VS2010 and have recently switched to using a Domain Service to give greater control over the data presented to the client. I've noticed that the AutoGenerate<Action>Button attributes on my GridView are being ignored. The presence of the Edit and Delete buttons appear to be contingent on the existence of Update and Delete methods on the partial classes autogenerated in the Domain Service, but i'm not seeing how to control the generation of the Select button. Is there a way to control this from within the Domain Service class?

Timeout expired. The timeout period elapsed prior to completion of the operation or the server is no



 I keep getting the following error. I also added time out parameter in the connection stirng and it still did not help. Has any one faced similar issues.

Thanks in adavance.

Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.


Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[SqlException (0x80131904): Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.]

Any framework for creating a job scheduler service?


Just curious to know if there was any official Microsoft code blocks, classes, or such for writing a service that runs other assemblies or WCF services?  That can be configured easily from a web page, pre-coded, for running tasks at certain times on certain recurring intervals?  I've already built one but am open to anything done better- which I'm sure there is.  Thanks!!!

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