|
I can't help but feel that I've seen this post somewhere else...
"On one of my cards it said I had to find temperatures lower than -8. The numbers I uncovered were -6 and -7 so I thought I had won, and so did the woman in the shop. But when she scanned the card the machine said I hadn't.
"I phoned Camelot and they fobbed me off with some story that -6 is higher - not lower - than -8 but I'm not having it."
-Tina Farrell, a 23 year old thicky from Levenshulme, Manchester.
|
|
|
|
|
This is for a web app. I have a situation where I need to copy an bunch of files to another location but still give quick feedback to the user. Right now the file copy is inline and the performance is not great. I am considering threading off each file copy so I can give quick feedback to the user. If a copy fails it is not a big deal and the user will not access the copied files immediately. My concern is that hundreds of short running threads could drive CPU through the roof.... Does anybody have any experience with this or have any suggestions? Please let me know.
Dave
|
|
|
|
|
Hi Dave,
two comments:
1.
the normal approach to handle N jobs is to have a queue and a couple of threads; stuff all
the jobs in the queue, then let each of the threads fetch a job from the queue and execute
it, until the queue is empty. That way you get load balancing amongst the threads, and
only need a selectable but limited number of them, fitting the capabilities of the entire
system.
2.
whatever you do, chances are the limited bandwidth of your disk storage subsystem will keep
your CPU quite a long way away from the roof.
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use PRE tags to preserve formatting when showing multi-line code snippets
|
|
|
|
|
davidhart wrote: have any suggestions?
You should look into other aspects of the Microsoft Application Server family like Com+ or Message Queues for example. I advise against starting threads from an ASP.NET thread.
|
|
|
|
|
Hi,
i am trying to restart and application from within by using a batch file.
this is my batch:
TASKKILL /F /IM MyApp.exe /T
PAUSE
start MyApp.exe
when i run it by double clicking it - it does the job - closes and reopen MyApp.exe.
when i try to do it from the application by using :
System.Diagnostics.Process p = new System.Diagnostics.Process();
String path = Application.StartupPath + @"\";
p.StartInfo.FileName = path + @"ResetApp.bat";
p.Start();
the batch kill my application but doesn't restart it(doesn't get to the pause line in the batch file) - i guess that when my application is terminated it also kills the batch operation.
how can i detach the batch from the application, or is there other way to make my batch run from the application indepentlly?
thanks,
Samy
|
|
|
|
|
You could just try Process.Start(path + "ResetApp.bat");
Alternitavely, you could try starting your form, from within the OnFormClosed event, which gets fired:
[STAThread]
private static int Main(string[] args)
{
Application.Run(new MainForm());
} After the form has closed, but before your program actually ends.
^ This is of course assuming your using forms, and its not a console app.
My current favourite word is: PIE!
I have changed my name to my regular internet alias. But don't let the 'Genius' part fool you, you don't know what 'SK' stands for.
-The Undefeated
|
|
|
|
|
You start the application back up immediately so you must want it running? But it's already running so..... what the heck are you doing?
|
|
|
|
|
i want to have the abillity to restart it remottly (if for some reason duriing its operation somthing went wrong)
any way found my problem in the batch - kill shouldn't use /T that kills all related proccess.
thanks
|
|
|
|
|
samy100 wrote: i want to have the abillity to restart it remottly (if for some reason duriing its operation somthing went wrong)
Then make it a windows service and manage it remotely from the Microsoft Management Console.
|
|
|
|
|
Why not try to make sure there are no bugs in it, and catch any errors that may occur. That way the app will keep running even if something does go wrong.
My current favourite word is: PIE!
I have changed my name to my regular internet alias. But don't let the 'Genius' part fool you, you don't know what 'SK' stands for.
-The Undefeated
|
|
|
|
|
Hi,
Bear in mind that batch files are run by the command processor, cmd.exe. If you do want to go down the batch files route then you need to do something like "cmd.exe /c resetapp.bat".
Alan.
|
|
|
|
|
You can use Application.Restart() method to restart your application
|
|
|
|
|
I never knew that was there. Guess i never needed it.
My current favourite word is: PIE!
I have changed my name to my regular internet alias. But don't let the 'Genius' part fool you, you don't know what 'SK' stands for.
-The Undefeated
|
|
|
|
|
Guys,
I have a simple C# app to send e-mail. bud wen i click on send mail button i get this error:
Syntax error, command unrecognized. The server response was: AVG POP3 Proxy Server 7.5.494/7.5.503[269.15.8/1185].
I googled a lot bud nothin found. Somebody pls a idea?
|
|
|
|
|
What does the code look like that is supposed to send the email?
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Paul, thanx for your response. here is my code:
MailMessage mail = new MailMessage();
SmtpClient server = new SmtpClient("smtp.myserver.nl", 110);
server.Credentials = new System.Net.NetworkCredential("username", "password");
mail.From = new MailAddress("kb@myserver.nl");
mail.To.Add("kb@myserver.nl");
mail.Subject = "test";
mail.Body = "mail via Time it applicatie";
//SmtpMail.SmtpServer = "smtp.myserver.nl";
try
{
server.Send(mail);
MessageBox.Show("succesvol verzonden");
}
catch (SmtpFailedRecipientException error)
{
MessageBox.Show(error.FailedRecipient);
}
|
|
|
|
|
uhm.. are you sure your smtp server is on 110? normal smtp-servers are on port 25. 110 is pop
|
|
|
|
|
yes i m sure. i checked it.
|
|
|
|
|
so then the output AVG POP3 Proxy Server 7.5.494/7.5.503[269.15.8/1185] . comes from an smtp server with an identity-crisis?
|
|
|
|
|
I don't know what happend, bud i get now a another error:
Failure sending mail.
A connection attempt failed because the connection party did not properly responed after a period of time, or established connection failed because connected host has failed to respond.

|
|
|
|
|
and what happens if you change this
<br />
SmtpClient server = new SmtpClient("smtp.myserver.nl", 110);<br />
to
<br />
SmtpClient server = new SmtpClient("smtp.myserver.nl", 25);<br />
?
|
|
|
|
|
this is a good one, got the same error: Failure sending mail. no connection.......
|
|
|
|
|
is smtp.myserver.nl the actual name of that server?
|
|
|
|
|
the actual name is: smtp.kmo-ict.nl
|
|
|
|
|
ok well on 110 there's actually a pop3 server running.. and i think the smtp service was not started.
so you should activate the smtp service in exchange (i'm not sure but i think it's deactivated by default.)
|
|
|
|