0

I have a method in a controller which send mails to users. One usecase of the admin part call this method and send mails with a duration about 1 hour. During this time I can't call again this method.

Is the call of a method in ASP MVC is blocking ? Should I use

async Task<returnValue>

?

I tried it's not working may be it is not the good usage.

Problematic method is

    public ActionResult SubscriptionsSendMails()
    {
        // Code to send mail (1 hour execution)
    }

If anyone know a solution, thanks in advance for his answer.

G. Frx
  • 2,350
  • 3
  • 19
  • 31
  • I editted my question but I don't think it's usefull... The code inside don't matter. – G. Frx Jun 15 '16 at 09:43
  • 1
    The actual question you should be asking is _"How to execute long-running background tasks in ASP.NET?"_, which has been very thoroughly documented all over the web and this site. But this is caused by the session lock, you can only execute one call at a time to ASP.NET per session. See duplicate. – CodeCaster Jun 15 '16 at 09:48
  • Have you try with `Thread`? – erikscandola Jun 15 '16 at 09:50
  • @erik no, do not suggest to manually spin up threads in ASP.NET. – CodeCaster Jun 15 '16 at 09:52

0 Answers0