Architecture :: How To Run Code In A Separate Process

Nov 3, 2010

I am not sure exactly which topic this post should go under...

Here is what I am doing.

I have a web form where a person will edit their blog article. At some point, once they are done editing, they can click a button "Publish Blog Now".

Once the blog is published in the click event on the server side I am doing a query to get a list of subscriber email address.

These are people who subscribed to this blogger and wish to receive an email notification whenever this person publishes a new blog.

What I just realized today is that my hosting provider only allows me to send a maximum of 200 emails per hour. Which means in my loop I need to sleep for roughly 20 seconds between each email notification sent. But I dont want the user who clicked the publish button to have to sit there and wait while that process is going.

How can I return to the user but yet continue to run some code on the server side to send out the emails in the background even if user closes web browser?

This is an ASP.NET web application targeting .net 4.0 and I am using c# as my back-end language and VS2010 as my development tool.

View 7 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

How To Recognize Whether The Process Is The IIS Worker Process From Within A .NET Code

Dec 25, 2010

Dear ladies and sirs.

I have a .NET infra code running both within the IIS worker process and within a desktop client app. How can the .NET code determine whether it is running within an IIS worker process?

I know that I could check the name of the process (w3wp.exe, for instance), but I would like a more robust approach. I wish to make a side note. This is not a production need. I need this information to enable certain scenarios useful during the development and testing phase. Specifically to ease the testing of secure vs non secure configurations.

View 3 Replies

Architecture :: Use Separate Pages Or Make One With Multiple Views?

Nov 15, 2010

I'm working on a webforms aspx app (not MVC) and I'm not sure if I should just create separate pages or somehow make multiple views on the same aspx page for the following scenario: Basically, I need to give the user the option to view a set of data a few different ways (essentially different group by's from a data perspective)... the data is always the same, its just a matter of how to arrange on the page...

each way I need to present the data will essentially consist of 2 repeaters, one nested inside the other. The outer repeater will display a nice header section with the nested repeater showing the list of items under that heading. view by book title (title is outer repeater, with the book list being the nested repeater, yes, multiple books with same title for this example - the app has nothing to do with books, this is just to illustrate)

Book Title: A Good Story
Author - Publisher - ISBN
Dan Johnson - Smith Publishing - kjdkjfd99898989
Susan Day - Smith Publishing - aa777fd99ff
Greg Greger - Corp XYZ - amkj897hgrt554

Book Title: Another Good Story
Author - Publisher - ISBN
Frank Franky - Corp XYZ - kj3kjfd9d9980
Jason Cambel - Smith Publishing - 7g7fddddttt
Jill Breker - Smith Publishing - d9ddt523321

Or, view books by publisher (here the publisher would be the outer repeater and the list, with different fields compared to first view, is the nested repeater.

Publisher: Smith Publishing
Title - Author - ISBN
A Good Story - Dan Johnson - kjdkjfd99898989
A Good Story - Susan Day - aa777fd99ff
Another Good Story - Jason Cambel - 7g7fddddttt
Another Good Story - Jill Breker - d9ddt523321

Publisher: Corp XYZ
Title - Author - ISBN
A Good Story - Greg Greger - amkj897hgrt554
Another Good Story - Frank Franky - kj3kjfd9d9980

so what do I do here? Just making separate pages is simple and would work, but is there something else I should be considering? There will be 3 different views, so 3 pages total if I went that route. Something is making me think I should be doing this all within one aspx page? maybe just toggling the visible property of the repeater controls? but then I was thinking each of these repeater controls is databound, and I assume even if they are not visible they still incurred database hits to get the data, right? and that could be bad?

View 4 Replies

Architecture :: Web Page Pre-process?

Apr 19, 2010

Is it possible to pre-process the web form (e.g. replace some strings with other strings) when it's requested while not executed?

View 4 Replies

Visual Studio :: Missing Code Browser For Pages With Code Not In A Separate File?

May 1, 2010

I'm missing a the code browser when I create pages that have the code not placed in a seperate file. For pages with .asp.vb files I get the browser correctly.

I think it's called a code browser but just in case it's not I mean the dropdown that shows Page Events, Buttons and other controls that can be selected along with their events.

How do I turn on those dropdowns for pages with code behind that uses <script> tags in the actual .aspx page?

Included (Showing page events just under the tab):

Missing

View 1 Replies

Architecture :: Schedule The Process In The Application Server?

Apr 11, 2010

Coming to my task, I have to schedule a process which will delete all the files in the paticular table with particular key.I have the stored procedure for the deletion. What all I need is, How to schedule this process in the application server.?

View 5 Replies

Architecture :: Process Of Creating An Audit Trail System?

Jun 9, 2010

I am in the process of creating an audit trail system. Simple enough. Certain fields require audit trail. What is the best design concept to allow this to work in multiple applications without having to change much? I would of course leave it to the admin of the site to add what fields should be audited, but the logic is the problem. Would implementing the interface IComparable be a place to start? My initial thinking is to compare 2 arrays against eachother and do an insert of what fields are in question. Array1 are the fields in the form, array2 are the fields from the sql table that require auditing.

View 8 Replies

Architecture :: Running Time Consuming Process Behind The Scene?

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

Architecture :: How To Process Data After Page Is Completely Loaded For The User

Aug 23, 2010

I have some logging that has to be done, which are some database update or inserts.

However this logging is of no importance to the user, so I only want to process the data/logs after the page is completed for the user.

As of now, if I process the data while the page is loading, I go from 1.4 to 2.0 speed (server side time processing of code), which is quite a bit comparing it is of no use to the user.

So I want this code only executed after that the page is complete.

I've been checking out Ajax, async pages etc, but the problem is it still gets executed before the page is rendered to the client, which means the client will have to wait longer then it is not being processed.

I've been checking out Threadpool.queueBackgroundWorker, however if I get it correct, this will still be executed before the page is shown to the user, as it has to complete before the prerender.

Then I thought about creating a new thread, and do the processing there, which would not have my page waiting to complete the data/logging.

However when I have 100 or 200 users loading pages at the same time, then that would mean I would be creating 200 threads on those loads, which I doubt will be good for performance. So if I want to solve this, I would have to create my own threadpool and only assign for example a max of 40 threads to it which can process the data.

All I want to get done, are some update/inserts into database after the page is rendered and shown to the user. I don't want the logging to slow down the pageload for the users obviously. I want that logging or no logging makes no difference to the pageloadtime for the user at all.

View 5 Replies

Web Forms :: How To Make The Separate Code File Work

Oct 21, 2010

I am using some code I found that generates a random password. I am in the habit of putting code in a seperate file. The code was written in the same file and I'm trying to move it to a seperate file and get the following message. Also, below, I posted
the original code (code on same page as aspx) and what I did (code in seperate file).what adjustment needs to be made to make the seperate code file work?

Compiler Error Message: BC31143: Method 'Public Function GeneratePassword(length As Integer, numberOfNonAlphanumericCharacters As Integer) As String' does not have a ignature compatible with delegate 'Delegate Sub EventHandler(sender As Object, e As System.EventArgs)'.

Source Error:

[Code]....

ORIGINAL CODE (with code on same page)

[Code]....

MY CODE BEHIND

[Code]....

[Code]....

View 2 Replies

WebMatrix :: Razor Syntax - Separate Code From Markup

Aug 28, 2010

While it has gnerally been advocated to separate code from mark up and all that, with the razor syntax and webmatrix all that is not valid anymore, I think. WebMatrix encourages code and mark up in the same page! So what is the best practice as far as code and mark up is concerned.

View 6 Replies

Databases :: Separate Zipcode In Excel / Need To Get The 5 Digit Zip Code

Jan 19, 2010

We have a spreadsheet that has a Zip column. These zip has a plus 4 digit in this format 99999-9999. When I looked at the format of this cell, it was a Special format with Zip+4 type. I just need to get the 5 digit zip code but the problem I am running into is the leading 0s. I tried =LEFT(A2, 5) but this trims the leading 0s. I also tried highligiting the column, then DATA -> Text to Columns -> Delimeter with hyphen but that didn't work. Is there any other way to do this or am I missing something on my first two attempts. Please let me know if you need more clarifications.

View 4 Replies

Organize Code Outside The App_Code Directory Or Into Separate Projects?

Feb 25, 2011

I've been working with MVC for awhile and I'm not sure what works with asp.net.

Is it possible to organize code outside the App_Code directory or into separate projects? How would this be done?

View 2 Replies

.net - Create Separate Textbox For Numbers And String Using C# Code?

Oct 28, 2010

I want to create separate textbox for numbers and string using c# code. I should not use jquery or javascript.

Condition:

Numeric Textbox: It should not allow characters, special characters.
String Textbox: Should not allow numbers, Special characters.

View 3 Replies

Web Forms :: Calling Variable When Set In Separate Code File - Can't Work Out

Feb 8, 2011

I've done a search and read a few things, All i'm trying to do is set a variable in the code file and call it in the page file asp.net vb.net 3.5. I've tried like this in the code file:

[Code]....

And in the design part of the page:

[Code]....

But it says that name isn't declaired. What am I doing wrong?

View 7 Replies

Visual Studio :: VWD 2010 - No Option To Allow Code To Be Placed In Separate File

Jan 2, 2011

This question has probably been answered before, when adding a new web form, I do not see an option that allows you to place code in a seperate file for a project (it does it automatically). But for websites, I see the option. Am I missing some option?

View 1 Replies

Web Forms :: Attach A Separate File Code Into Aspx Page?

Nov 8, 2010

I have a separate aspx Page called Home.aspx page and a separate class called class1.cs

I want to attach the class1 into Home.aspx

I try with this but not work

[Code]....

View 5 Replies

DataSource Controls :: Display Results From Two Separate Tables In Two Separate Databases?

Jan 14, 2010

I have access to two seperate databases (mySQL) located on two servers. I need to get the data, link the tables on a key field and display the results in a datagrid. My challenge is that if the search criteria changes for the display it affects rows returned from on table and should thus automatically affect the linked table and resulting data returned.

what the best approach would be to achieving this? So far I have set up a dataset with a dataadapter and table for each connection and then linked the tables in the dataset. The problem that I'm having is getting the linked resultsets to work.

On my form I have the datagrid with two Objectdatasources one for each dataadapter and i believe that's where I'm going wrong...

View 1 Replies

Web Forms :: Started Process Not Executing Any Code When Run Through IIS?

Aug 23, 2010

I am calling a simple console application (exe) using process.start. Within this application, I am writing events to the event log.

View 6 Replies

Web Forms :: Connection To Database From Local Visual Studio Not Working - Code In Separate File?

Mar 11, 2010

I recently started NOT putting code in separate file. I am using vb. I am having a problem with my database connection. The live code is working just fine....but when I try to debug locally. i get this error. connection to the database from my local visual studio is not working. A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)

<%@ Page Title="" Language="VB" MasterPageFile="~/MasterPage.master" %>
<script runat="server">
Const ConnectionString As String = "Data Source=1234.database.com;Initial Catalog=database_name;Persist Security Info=True;User =user_name;Password=123456"
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Dim MyConn As New Data.SqlClient.SqlConnection(ConnectionString)
Dim cmd As New Data.SqlClient.SqlCommand("Select count (*) from Classifieds where (ClassifiedCatagory = 'Antiques')", MyConn)
cmd.Connection.Open()
Dim count As Integer = cmd.ExecuteScalar() 'this contains the number of records
Label_Antiques.Text = count
cmd.Connection.Close()

View 4 Replies

Shopping Cart Coupon/discount Code Process?

Feb 4, 2011

I want to add coupon/discount code to custom asp.net site that already has a shopping cart. I'm looking to see if there are any resource on best practice to implement this feature in asp.net. There might also be a third-party product that is out there.

View 1 Replies

Security :: Cannot Run System.Diagnostics.Process.Start In Code Behind Under IIS

Jun 30, 2010

I can not run System.Diagnostics.Process.Start(@"wmplayer.exe") in code behind under IIS, - nothing happens, though I can do it successfully using Visual Studio ASP.NET Development server. I read topic http://support.microsoft.com/kb/555134 and made as recommended: 1) Made ASP.NET worker process run in SYSTEM account 2) Enabled IIS Admin Service to interact with desktop and rebooted serivce. - wmplayer.exe does not start, even its process does not start. I tried start notepad.exe and it partly works - process starts, I see only window frame, but not menu and can not interact with it. The other thing I tried is to put it under out-of-process (IIS virtual folder properties) and gave the process administrative rights (changed identity in Component Services): no result.

View 6 Replies

Possible To Use PHP As Code To Process Website Email Contact Form

Mar 16, 2015

I have a basic Web site project in VB.NET (Visual Studio 2013 Express for Web), and was wondering if it would be possible to use PHP as the code to process the Web site's email contact form. That is, PHP would be part of a myContactForm.aspx Web page and, if so, are Windows servers acceptable to PHP? Do Windows servers and PHP like one another?

For some reason I have in my mind the idea that ASP/ASP.NET = Windows servers, while PHP = Unix servers.

View 15 Replies

VS 2005 Code Returns The Process ID Correctly With Virtual Server?

Jan 29, 2010

I am using this code to get th ProcessID of newly Created Excel.

Code:
Imports Microsoft.VisualBasic
Imports Microsoft.Office.Interop
Public Class Class1
[code]....

This code returns the Process ID Correctly with Virtual Server. Now I deployed it using a Website, and the ProcessID is 0

View 7 Replies







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