Proper way to asynchronously send an email in ASP.NET… (am i doing it right?)

前端 未结 9 1664
时光取名叫无心
时光取名叫无心 2020-12-23 10:57

When a user registers on my website, I don\'t see why I need to make him \"wait\" for the smtp to go through so that he gets an activation email.

I decided I want to

9条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-23 11:13

    I worked same issue for my project:

    First tried Thread as you do:
    - I loose context
    - Exception handling problem
    - Commonly said, Thread are bad idea on IIS ThreadPool

    So I switch and try with asynchronously:
    - 'asynchronously' is fake in a asp.net web application. It just put queue calls and swicth the context

    So I make windows service and retrive the values through sql table: happy end

    So for quick solution: from ajax side make async call tell the user fake yes, but continue your sending job in your mvc controller

提交回复
热议问题