What Is A Reliable Way To Run Time Consuming Tasks In MVC2
Sep 15, 2010
I need reliable way to run 10 different tasks simultaneously. For instance the first one would be sending emails, while the next one is cleaning rows from a specific table... so on an so forth.
I've used the Thread class and while it works well on my development machine (VS2010 internal web server) non of these threads seems to be working at all on my production server. And I don't know of an effective way to debug the problem on the production server.
I saw this technique which encourage you to register cache objects. Since the application fires a callback when a cached item expires, then it's possible to run any code to mimic threading behavior. It seems a little Micky Mouse like.
View 3 Replies
Similar Messages:
Mar 31, 2010
say you have a table named 'Events' and in there is a list of items such as:
ID = 1
EventName = Staff Meeting
StartTime = 10/04/2010 10:30:00
EndTime = 10/04/2010 11:00:00
---
ID = 2
EventName = Customer Meeting
StartTime = 15/04/2010 13:00:00
EndTime = 15/04/2010 14:00:00
and so on (many more records). Now, whenever a record reaches its' end time, how can I execute SQL commands to delete that data (or mark as finished) and UPDATE another table?
This needs to be running constantly so I was thinking of building it into a Windows Service but can you suggest a better way of doing it?
View 4 Replies
May 24, 2010
I have just started to look at the new "System.Threading.Tasks" goodness in .Net 4.0, and would like to know if there is any build in support for limiting the number of concurrent tasks that run at once, or if this should be manually handled.
E.G: If I need to call a calculation method 100 times, is there a way to set up 100 Tasks, but have only 5 execute simultaneously? The answer may just be to create 5 tasks, call Task.WaitAny, and create a new Task as each previous one finishes. I just want to make sure I am not missing a trick if there is a better way to do this.
[code]....
View 5 Replies
Aug 31, 2010
I have a aspx page in which i create reports and charts on the fly. Creation of these charts and reports takes a lot of time because of which a blank screen is shown to the user until the creation completes.
can unlink actual report and chart creation code from page load so that i can show a processing text and then show the generated chart or report once it is ready.
EDIT :-
I would want to do something like this -
on first request trigger the report or chart creation and register a call back for completion. the client can then poll the server every 2-3 seconds to check if the report creaetion is complete.
View 2 Replies
Dec 23, 2010
My web application currently requires users to upload files, after which I take it for "further processing". This processing is VERY time consuming and can take a while before the control gets back to the user. I would like to run this in the background and not have the user wait until this completes.
I know this question has been asked in this very forum before but I'm not able to understand or I'm not able to proceed in the right direction. My understanding is there are a few ways I can go about this
a) create a BackgroundWorker process in my Global.asax file that will spawn a process and take care of the activity.
b) create a web service that will do the processing for me .. (how?)
c) Use Ajax (Again how?)
View 2 Replies
Oct 28, 2010
I have a function which performs a series of time-consuming operations which include querying a large database, customising an excel file and sending an email with a 5MB attachment.
I would like to excute this function in the background, when a button is clicked, and immediately redirect the user to another aspx page. The user should be free to browse to other pages or even close the browser when the background operation is still running on the server. I have tried to implement threading but could not get it to work. The email with attachment does not get sent even though there are no errors.
View 5 Replies
Dec 27, 2010
I have worked on many localized sites in the past, using mainy some standard patterns and techniques involving Global/Local RESX files as well as session to maintain currently selected language.
However, it is quite difficult to maintain from a translator point of view, we used a small tool that converts RESX to Excel and then the localized Excel back to RESX, but for some reason this technique doesnt work properly anymore...
better and more reliable tools (paid or free) that can be used to localize RESX and provide translation team a better/easier way to localize content?
View 3 Replies
Jan 22, 2010
On a ASP.NET MVC should the error pages be the most independend possible?
I mean be full HTML code with no relation to databases, render actions, render partials, master pages, etc?
There would be only the actions to return the, for example, NotFound and UnknownError views and then place those url in Web.Config custom error section.
View 2 Replies
Mar 16, 2010
I know I can use Request.Browser.IsMobileDevice.
But does anyone know how it works, and if it is reliable and up to date?
View 6 Replies
Mar 11, 2011
The Request.Browser.Cookies property (of type bool) attribute stores information whether client's browser supports cookies and whether or not they are enabled.How reliable is the property Request.Browser.Cookies? Is it guaranteed to be correct ? Or should I rather implement redirection technique suggested by Software Monkey in this question?Please note: This in not a question "are cookies reliable" ? This is a question: "Is the information whether users browser accepts cookies reliable?"
View 2 Replies
Sep 26, 2010
I want to have an upload functionality for uploading large files -- as large as 1GB. I see some sites successfully implementing reliable upload functionality without using any upload clients e.g. ActiveX, Java, etc. Some suggest, the secret is sending the large file in smaller and more manageable chunks to the server. If that't the case how do I handle that?
View 4 Replies
Mar 9, 2011
I use Go Daddy's relay-hosting.secureserver.net for my SMTP client. I've coded it to use the user's email address as the "From:" address, in order to develop an outlook rule that sends a confirmation email to the user, informing them that their input was received. But using Go Daddy's relay-hosting.secureserver.net as an SMTP client prevents this from happening if the user has an email from "@yahoo.com", "@gmail.com", "@hotmail.com" etc, etc.
We did some research and found that this relay hosting server is not always reliable. We've had problems where users have submitted input, but the input was never received.Is there anything else I can look into that will send email via my ASP.net page?
[Code]....
View 4 Replies
Sep 14, 2010
programming option?Our Web application could have 60000 database requests/second or more in future.Which is better: MS-SQL or MySQL or other?Which is better: Asp.net, PHP, JSP or other?What kind of webhosting is reliable for auto-scaling?Any good webhosters or hosting plans?
View 1 Replies
May 7, 2010
What are the pros and cons between using the ASP.Net control compared to the old reliable table html implementation. I know that the asp:Table will end up on the returned page as a html table, and from looking into it so far people are saying its easier to work with the asp:Table in the server side code, but I'd love to hear what the stackoverflow community has to say about the matter.
View 3 Replies
Sep 16, 2010
I am a beginner of C# programming. I have read a few books about C#.net. But I cannot find some exercises in the books. Someone told me to build up a blog to practice my coding.
But it is a huge task for a beginner. I just want some tasks to have a step by step learning process.
View 3 Replies
Jun 21, 2010
I used Castle Windsor before and had this routine that fired the certain method of all classes that implement a certain interface.If I recall correctly, the interface was IBootStrapTask and only had an excecute method. Then, for instance, I'd place all my route registrations in one of these, and know it get fired on application startup.Have to admit I did not understand the code to well, so I'm even more unsure how can I do this. I'm using structure map now. (still knowing very little about it)
View 1 Replies
Jan 29, 2011
In my ASP.NET website, I am having a function which has to be automatically performed once every 2-3 mins on its own, i.e. without user intervention. This function contains database access.
Can I use threading to perform this process in background?
If Yes, How can I use that?
Edit
Also I am not looking for a solution which includes windows service because I am using shared hosting. So I dont have all the rights to access the host computer.
View 5 Replies
Jan 12, 2010
I am little bit confuse with Asp.net MVC Area.
When we talk about WebForms we say, for Administrative tasks, you must have an Admin folder to separate the admin task.
In MVC how i will treat my Admin tasks?
I will go for Admin Area or Admin Controllers,
Because if i will write controller for Admin tasks, each and every task will be written in one controller (AdminController) or if i will write Area -> Controller, means i will need to write at-least two controllers for each feature.
Second if we breaks the application in Areas (as modules) how i will manage Admin task for each Area.
View 1 Replies
Apr 4, 2011
We have a timer process (a JQuery plugin) that redirects after X number of minutes to the login page, all via JavaScript. When the timer hits zero, I want to run a task (could be anything; however, in this specific scenario, it's a web service call).
So the process does:
if (zeroedOut) {
window.setTimeout(function() {
//Run finish-up processes
}, 0);
window.location = "login.aspx";
}
The issue I'm having is the web service that runs with the finish-up processes is not being called. The web service call happens, the redirect happens, I don't see any errors (I have try/catch statements around the setTimeout call), but no WS call.
View 1 Replies
Feb 6, 2010
As part of the web application I am working on there will be functionality to export data from the web application into a windows application copying the data between the database for the web application and the windows application. The databases for these two programs could have been combined but are being kept apart for simplicity.The utility to export the data can be triggered manually from the web application but it is also required that this task can be scheduled to run by the user (once a day, on web app shutdown etc)
I envisage this to be run as a service - I have created services for windows applications before but this is the first time I have needed to create this for a web application. Searching on goggle, I have found an msdn magazine article that suggests creating a web service and then creating a windows service which would call into this web service. So in my situation, I am thinking that I would create a web service which would contain the data transfer functionality between the web application and the windows application. Then I would create a windows service which would be installed as part of installing the web application, which would then call into the web service (at pre-defined intervals) using settings configured by the user within the web application (so that the data transfer functionality can be scheduled).Does this seem the correct solution? I would appreciate any advice on how I might achieve the above.
View 3 Replies
Mar 14, 2011
How can I add a Task in Windows Scheduled Tasks using Asp.Net.
View 3 Replies
Oct 3, 2010
This is my first forray into ASP.NET MVC, having been doing WebForms for nearly 6 years now. I've read through various tutorials and guides on getting started with MVC, but I've a few questions about how you're meant to do things:
UserControls for entities
In an application I wrote a few years ago (using WebForms) there were many entities that had an associated postal address (which existed as an instance of an Address class), so I created a UserControl that contained fields for working with addresses. During the page lifecycle I would pass the business object's .Address property to the UserControl for display and for population upon a successful and valid postback. How would I do something like this in MVC? My current project has a similar situation where common sets of fields are repeated throughout the application and all 'map' to the same class.
Modifying the page/view on 'postback'
Say I'm working on a data-entry form for an online B2B ordering system, where the user manually enters order items into a series of textboxes arranged in a table. The system can only provide so-many textboxes at a time (usually 5 or 10). If the user ran out of textboxes they would click an "Add more rows" button that performed a postback that was caught by that button's server-side .Click event handler. The page's class would then add more rows to the page; ASP.NET's stateful nature made this easy to implement. But in MVC there is no ViewState and I haven't found much information about how you'd do this, or anything like this. All of the tutorials and guides assume a form posting is only for data submission.
Multiple tasks per page/form
In a similar vein to the above, how do you create views that perform multiple tasks? In my above example I cited a webform that had two buttons: one to submit the form for actual processing, and another button that just modified the page (by adding more data-entry rows).Given that Controllers' actions are bound to URIs rather than what combination of fields were submitted, does this mean that I would have to interpret the posted data myself and branch based on that?
Componentised self-contained controls (e.g. sidebar forms)
Finally, in many web applications you have the main form in the middle, but also things on the periphary of the page (e.g. a sidebar) that might have their own logic. For example, in one WebForms application I wrote last year there was a 'Quick contact' form in a UserControl located elsewhere on the page. When the user clicked the form's button the UserControl's logic handled the postback details independently of the page containing the UserControl (but there was only one <form> element in the whole rendered page). The user was returned to the page they clicked the button on, with everything in identical state as to how it was before, exccept for the UserControl which reported that the email was sent. Again, MVC's stateless nature would make something like this hard to implement, unless there are some techniques not covered in the tutorials?
View 2 Replies
Jul 29, 2010
I am experimenting AsyncController feature. What I did is set up two tasks to run in parallel. As in the code below, the problem is that sometime all tasks finished and return successfully, sometime only one task finish and sometime each task finish half of it's work and return. It is weird, what did I do wrong?
[Code]....
View 29 Replies
Jun 24, 2010
I try to get an understanding of the performance of a web page and use Trace.Write
Problem is that I use Parallel.Invoke and starts more threads where I would like to report back using Trace.Write
Parallel.Invoke(() => Chart1AndLegend(param),
() => Chart2(param),
() => Chart3(param),
() => Chart4(param));
I have realized that Trace.Write is not a good way of tracing as it is gives you the time since last entry which makes no sense if more threads are writing.
View 1 Replies
Mar 23, 2011
I am writing a quick-and-dirty in-house ASP.NET application that needs to be able to run a task after a specific period of time. If it was a proper application, I'd probably use a windows service but I don't really want to bother with the extra complexity of that.I could put code in the BeginRequest handler to check whether any such tasks are due, but of course nothing would happen if nobody is using the application.at the moment the best option I can think of is something like ShellExecute("nohup sleep 1000; wget http://server/dummypage.aspx") (if you'll excuse the mixed windows/unix nomenclature).
View 2 Replies