Pergunta

Can anyone tell me, is there a way to run a process in IIS shared hosting service.

Suppose, the scenario is like "I want to send emails to a list of email id's after everywhere 3 hrs", so the challenge here is the process should not be invoked by a HTTP link. It should be automatic.

I think we can do this by IIS worker processes.

Also this all will be happening on a shared server(like GoDaddy) in IIS7, .NET 3.5

Please anyone give me a direction.

Thanks in advance.

Foi útil?

Solução

You should write and run this as a Windows service, assuming you have access to install a service.

You could run a background worker thread from your asp.net code-behind but the problem is that IIS will terminate the thread after it is idle for a relatively short period of time. I tried going this route, trying to geocode a list of addresses (800+, from a SharePoint list) and IIS kept timing out my thread and stopping it. We ended up going with adding events to the SharePoint list that would geocode when the item was changed/added to the list.

One other option you could look into is using Windows Workflow API, it was designed for this kind of thing.

Outras dicas

This question was asked ages ago, but for what it's worth - I ended up using Hangfire to handle my long running tasks in my ASP app.

You can easily configure it for shared hosting and then for a dedicated server if you can scale up / out according to your needs.

It's super easy to use, just follow the doc step by step.

Cheers, Andrew

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top