Trapping Client Disconnections On Long Running HTTP Requests?

Sep 9, 2010

I have a long poll HTTP request using ASP.NET 4, MVC 2 and AsyncController. If a user closes their browser and kills the HTTP connection without the request completing, I'd like to know about it and completely clean up after them. If I don't, the open and incomplete requests just sit there and eventually IIS stops accepting new requests.

You can simulate my long running HTTP request by making a normal ASP.NET application with a page that has a Thread.Sleep. Even if you close the browser, the request carries on as if it hasn't.

There is a property called Response.IsClientConnected that gets switched to false if the client disconnects, and I can poll this to achieve the desired effect but it's not very clean and I'd like to avoid polling. Is there a way of getting notified when this happens rather than having to poll this property?

View 1 Replies


Similar Messages:

Long Running HTTP Process - How To Put In Separate Process

Jul 21, 2010

I know that similar questions have been asked all over the place, but I'm having trouble finding one that relates directly to what I'm after.

I have a website where a user uploads a data file, then that file is transformed and imported into SQL. The file could be up to 50mb in size, and some times this process can take 30 minutes or sometimes even longer.

I realise I need to palm off the actual work to another process, and poll that process on the web page. I'm wondering what the best approach would be though? Being a web developer by trade, I'm finding all this new Windows Service stuff a bit confusing, and I just wanted somewhere to start.

So:

Can I do / should I being doing this with a windows service? if so, how?

Should I use WCF? If this runs under IIS, will I have problems with aspnet_wp.exe recycling and timing out my process?

clarifications

The data is imported into sql, there's no file distribution taking place.

If there is a failure, it absolutely MUST be reported to the user. The web page will poll every, lets say, 5 seconds, from the time the async task begins, to get the 'status' of the import. Once it's finished another response will tell the page to stop polling for status updates.

queries on final decision

ok, so as I thought, it seems that a windows service is the best idea. So as to HOW to get it to work, it seems the 'put the file there and wait for the service to pick it up' idea is the generally accepted way, is there a way I can start a process run by the service, without it having to constantly be checking a database table / folder? As I said earlier, I don't have any experience with Windows Services - I wondered if I put a public method in the service, can I call it somehow?

View 2 Replies

Selectively Redirecting HTTP Requests To HTTPS Requests?

Jun 18, 2010

What's the simplest and most effective way to selectively redirect HTTP requests to your ASP.NET page to its HTTPS equivalent? For example, if my page site URL is [URL], I want to redirect some (or all) page requests to [URL] What's the easiest way to do that?

View 2 Replies

Web Forms :: Timeout Error Continues On Long - Running Web App Supposedly Already Configured To Accommodate Long

Jun 16, 2010

I've developed a web application to accept video file uploads and then pass them to a backend service on an external server. The application runs without error on the visual studio debugging webserver, but once on a production iis 6 or 7 server, yields a timeout error at about a consistent amount of time into handling a large upload. Specifically, it errors in the middle of transferring the video file to the external server, once the application has successfully received it from the client. I'm aware of several timeouts to be configured related to the problem, and have done so. The application's web config has been tested with one or both of the following settings

<system.web>
<httpRuntime executionTimeout="9999999" maxRequestLength="2048000" />
</system.web>
and
<configuration>
<location path="default.aspx"> (the page at issue that's timing out)
<system.web>
<httpRuntime executionTimeout="9999999" maxRequestLength="2048000" />
</system.web>
</location>
</configuration>

And within the initialization of the webrequest made to the external server to send the video received from the client browser:

HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create(url);
httpWebRequest.ContentType = "multipart/form-data; boundary=" + boundary;
httpWebRequest.Method = "POST";
httpWebRequest.Timeout = System.Threading.Timeout.Infinite;

So with the execution time limits on both the webform as a whole and the connection made to the external server, I'm at a loss for what timeout is left unconfigured, or how to determine such, when I continue to get the following error: Unexpected error executing Brightcove Upload:...........................

View 3 Replies

Databases :: Losing Connection When Running Long Running Oracle Procedure?

Jul 1, 2010

I am executing a long-running Oracle stored procedure from .NET. The procedure takes about three hours to run. Ideally, the user should be able to kick off the procedure, close the browser, and come back later to check the results.

The problem is that the connection to the Oracle procedure is lost after exactly an hour. As you would expect, the Oracle procedre runs to completion if it is executed from SQL Plus. Strangely enough, it will also run to completion if I run in debug mode on my local machine (I start two threads, one of which executes the procedure. I set a breakpoint on the second thread).

Here is my connection string:

data source= (DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=serverx)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=TestSID)))

Some relevant sections from web.config:

<sessionState mode="InProc" cookieless="false" timeout="3000" stateNetworkTimeout="72000"/>
<httpRuntime executionTimeout="18000" maxRequestLength="2097151" />

Any thoughts as to why the connection is being lost in exactly an hour, and what I can do to maintain the connection until the procedure finishes?

View 1 Replies

MVC's AsyncController Be Used To Service Large Number Of Concurrent Hanging Requests (long Poll)??

Feb 13, 2011

Frameworks like Node.js, Tornado, and Twisted let developers create server-push applications that supports large number of concurrent hanging requests (10k+). From what I understand, they all achieve this by not creating threads to service each hanging request.

Can AsyncController be used to service large number of inactive concurrent requests?If so, are there any reasonably large ASP.NET MVC websites using this approach to create long-poll applications?

View 1 Replies

Capturing The HTTP Requests For A Particular URL?

Mar 21, 2011

How can I capture all the http requests for a particular URL in .NET?

View 1 Replies

WCF / ASMX :: How To Get Raw Http Requests

Jan 20, 2011

I m invoking a web service and i would like to know if i get the raw http request?

View 4 Replies

Health Monitoring Of All HTTP Requests?

Sep 10, 2010

If I want to have log of all requests made within a web site including any http bad requests, is this possible?

For e.g I want to be able to see if every http request from the site including any for images that don't exist etc.

All the things an IIS log has.

Is this possible with HTTP Module or something like the ASP.net Health monitoring?

View 1 Replies

How To Monitor All Incoming HTTP Requests

Dec 13, 2010

I need to monitor my application from incoming http post and get requestf originating from outside and sometimes inside the machine.

Is this possible?

Been using fiddler but this only does outgoing not incoming (from outside the machine) or have I configured it incorrectly?

This is for my web app that is meant to be receiving a POST from an external server.

View 6 Replies

Sending Multiple HTTP Requests Asynchronously Using .NET

Aug 11, 2010

Is it possible to send multiple HTTP requests asynchronously to an ASP.NET web site or any other web server using .NET ? And, then. collect responses from those requests as they come using .NET asynchronous paradigm ? Is it possible ? Or would there still be limit of max 2 HTTP connections from .NET using HTTP ?

View 1 Replies

Iis - How To Support Compressed HTTP Requests In IIS7

Dec 10, 2010

For an ASP.NET 4.0 / IIS7 web app, I would like to support compressed HTTP requests. Basically, I would like to support clients that would add Content-Encoding: gzip in the request headers, and compress the body accordingly.

Does anyone known how I achieve such a behavior?

View 1 Replies

Multithreading - How Are Threads Tied To Requests Through Http.sys, IIS

Jan 29, 2011

I'm currently reading a lot about node.js. There is a frequent comparison between servers using a traditional thread per request model (Apache), and servers that use an event loop (Nginx, node, Tornado).

I would like to learn in detail about how a request is processed in ASP.NET - from the point it is received in http.sys all the way up to it being processed in ASP.NET itself. I've found the MSDN documentation on http.sys and IIS a little lacking, but perhaps my google-fu is weak today. So far, the best resource I have found is a post on Thomas Marquardt's Blog.

Could anyone shed more light on the topic, or point me to any other resources?

View 1 Replies

Http - Is There A Simple(ish) Way To Route All Requests To The Server

Oct 5, 2010

Here's the big picture. We're running a server in IIS 6 that hosts several web sites and applications, and we're in the process of moving the whole thing to a different data center with a slightly different setup. We've notified our users and updated our DNS info so that theoretically everyone will be happily hitting the new server from day 1, but we know that someone will inevitably fall through the cracks.

The powers that be want a "Listener" page/handler that will receive all requests to the server and log the entire request to a text file, including (especially) POST data.

That's where I'm stuck. I don't know how to implement a single handler that will receive all requests to the server. I vaguely understand IIS 6 redirection options, but they all seem to lose the POST data on the redirect. I also know a little about IIS 6's built-in logging, but it ignores POST data as well.

Is there a simple(ish) way to route all requests to the server so that they all hit a single handler, while maintaining post data?

View 1 Replies

C# - Connection Reset With Long Running Process?

Mar 18, 2010

In an asp.net web form, I keep getting a connection reset error message. The page is doing a some long running processing (about 2-5 minutes).

I have no problem when the web request comes from the same machine as the web server. But when the request originates across the network, I get a connection reset error about 1:30 or 2 minutes into waiting for a response.

I have set the in web.config for this application and put the application it's own application pool.

What else can I try?

Edit

The purpose of this page is to accept input from the user, calculate something, and send the result back to them. The long running calculation isn't something I can offload until a later time.

View 2 Replies

Multithreading - .net ThreadPool - Long Running Operation.

Jan 27, 2010

My application is a asp.net 3.5 running on iis 6 (windows 2003)

This application is serving 1000's of users daily (100-500 users online).

I want to send an email newsletter to customers weekly.

Around 200,000 emails every time.

This is the code im using:

ThreadPool.QueueUserWorkItem(new WaitCallback(AsyncProcessMailerQueue), null);

private static void AsyncProcessMailerQueue(object data)[code]....

When testing this locally (on my dev machine) i see the application is working alot slower.

Is there a better way to write this code? Should i use ThreadPool.QueueUserWorkItem or create a new thread using Thread t = new Thread(new ThreadStart(DoWork)); ? Will it be better to create a totally seperate application for the purpose of sending the newsletters. will that help if ill run this application on the same machine?

i've seen other posts here talking about ThreadPool vs Thread but its seem no one is sure which is better.

View 3 Replies

HTTP Requests In C# - Find A Specific Text Box In Webpage

Jan 20, 2010

I need to visit a URL, find a specific text box in said page - fill it with data and then submit a form.

How can I accomplish this in C#?

View 2 Replies

How To Sniff HTTP Requests / Capture Packets To A Web Application?

Apr 13, 2010

I want to sniff a local HTTP request to an ASP.NET web application.

Is telnet an option?

How do you capture packets to a web application?

View 6 Replies

Iis - Using Setup A Component To Redirect Response For Any HTTP Requests?

Aug 25, 2010

The objective of this component is to be able to forward whatever HTTP requests it receives to forward to a different server based on the parameters but keeping the URL and POST data intact. For example:

If the component receives

[URL]

It will return the response from either

[URL]

where XYZ can be valid name of the page. I think I can probably individually create each page to do a Response.Redirect but i am wondering if there is a more generic way to do this? In addition, is this something I have to configure on the IIS level rather than code level?

View 1 Replies

Do Web.config's Globalization Settings Affect Non-http Requests

Nov 15, 2010

In my ASP.NET application I set

<system.web><globalization culture="pl-PL" uiCulture="pl-PL" />

to have numbers and dates in this culture.

Surprisingly I noticed that methods invoked from job scheduler (Quartz library) use en-US? Why is that?

View 1 Replies

How To Make A Call To A Potentially Long-running Operation

Jul 23, 2010

When an ASPX page needs to make a call to a potentially long-running operation (lengthy DB query, call to a remote webservice, etc.), I use RegisterAsyncTask, so the IIS worker thread is returned to the pool, rather than being tied up for the duration of the long-running operation. However ASMX webservices don't have a RegisterAsyncTask function. When an ASMX webservice needs to call a potentially long-running operation, how can I implement the same behavior as RegisterAsyncTask? Note: the ASMX webservice is implemented as a script-service: returning json to a direct jQuery/ajax call. Therefore, I cannot use the "BeginXXX" approach described by MSDN, since that implements the asynchronous behavior within the generated client-stub (which isn't used when calling the webservice directly via ajax). EDIT: Adding source code: implemented the BeginXXX/EndXXX approach listed in John's answer. The synchronous "Parrot" function works fine. But the asynchronous "SlowParrot" function gives an internal server error: "Unknown web method SlowParrot"

WebService1.asmx:

[code]....

View 2 Replies

Separate Service For Processing Long Running Tasks?

Jan 12, 2011

I would like to makea windows service. whenever the user of my ASP.NET application has to do a time-consuming task, the IIS would give the task to the service which will return a token(a temporary name for the task) and in the background the service would do the task. At anytime, the user would see the status of his/her task which would be either pending in queue, processing, or completed. The service would do a fixed number of jobs in parallel, and would keep a queue for the next-incoming tasks. In addition there would be a WinForms application for system administrator that would allow adding special ADMIn tasks such as "Clean orphaned files" or "archive data of inactive users".

Can you point me to something that can jump start me on this as a whole concept - I know I can google for windows services and I am able to do it myself from scratch but time is of the Essence so maybe you know of something that is already there and i can use block to build out of.

View 1 Replies

How To Improve Progressive Enhancement For Long-running Tasks

Nov 2, 2010

I'm looking for ways to improve a web page that initiates a long-running (>2 minutes) server-side task. The current version of the page just clocks for the full duration of the task, which can be very frustrating to the user.

I already have a few ideas about how I could improve the user's experience, but they all would involve the use of AJAX to some extent. Because of previous experiences that I've had on this project, I know that not all users have JavaScript enabled or available.

Assuming that the server-side process has already been optimized as much as possible, what else could I do to improve the experience of all users as much as possible?

View 2 Replies

How To Show Status To User For Long Running Process

Jan 28, 2010

Note:- i don't want to use updateprogress etc. control of ajax

on button click, long task(e.g thread) runs in my webpage for about 4-5 minutes.I want to show status to user either by a processing image through javascript(image must be shown in a certain part of page other part of page will remain intact) or an exact status of process if possible. i have tried a lot but all in vein.

View 5 Replies

AJAX :: Update Page From Long Running WCF Service

Jan 12, 2010

I have a long-running WCF service that I need to call, but I would like to do is to open modal window (modal popup extender) that simply shows progress and stops the user from interacting on the page until the service returns. What I was trying to do was the following:

1. Click button to activate the process which calls a method in my code-behind.
2. This method opens my modal panel with some pretty animation.
3. I call my WCF service asychronously so that the UI will refresh.
4. Service ends which calls my delegate I setup.
5. My delegate method would then refresh the page with results, and dismiss the model popup.

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved