-1

I created an ASP.NET MVC application started on IIS. I need to call a process that has a bad influence on loading a page - it causes the page to load very slowly (taking over 30 minutes!).

I figured out that I could start the process 2 times a day and don't connect it with iis. I don't know how to start processes in a background. I heard about Windows Task Scheduler, but how can I use it? Can you help me/ give some advise?

I have my process written in c#.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
J. B.
  • 37
  • 1
  • 7
  • 2
    You can't rely on any scheduler working in IIS because of the application being recycled and what not. If you need something to run on a schedule, create a service instead, and use the windows scheduler to schedule a task. There's loads of resources for that, e.g. http://windows.microsoft.com/en-au/windows/schedule-task#1TC=windows-7 – Patrick Apr 18 '15 at 15:45
  • This sounds like a bad idea. What is the process causing bad influence? Is it under you control to modify it? – Yuval Itzchakov Apr 18 '15 at 15:46
  • I wrote a proccess that is pulling changes from remote repository – J. B. Apr 18 '15 at 15:50

2 Answers2

0

This might guide you to the right direction: http://www.hanselman.com/blog/HowToRunBackgroundTasksInASPNET.aspx

As well on process creation here: C# equivalent to fork()/exec()

I apologize in advance, I can't comment right now. But, do you mean 'how processes work in general' - like process creation, forking a child, etc...?

Community
  • 1
  • 1
macmania314
  • 457
  • 2
  • 18
  • Yes, I want a proccess working in the background which two times a day do something ( I need to pull changes from remote repository) , but I don't know how to configure that. It works as a console app, but of course I need to start it. I have no experience in running background proccesses – J. B. Apr 18 '15 at 15:58
  • I'm not adept in C# development but I have dealt extensively with process creation in C. So the idea of it is to make a process/fork it, put it in a process group by itself, schedule it to run, handle signals that come to your way. And delete them. This might also help you [background process library](http://docs.hangfire.io/) and more info on process creation: [.NET process documentation](https://msdn.microsoft.com/en-us/library/system.diagnostics.process.aspx) – macmania314 Apr 18 '15 at 16:08
0

you can try Task Scheduler Managed Wrapper,Very much configurable(C#).

Examples

Vikas Sardana
  • 1,593
  • 2
  • 18
  • 37