Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Using Await and async in ASP.NET app
Message
From
15/04/2016 13:16:18
 
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
01634709
Message ID:
01634851
Views:
29
>>>>>>An exe for example. Or a Windows Service.
>>>>>>
>>>>>>>How do you create a separate process for the email method? (just a hit of key words that I can start Googling, thank you).
>>>>>
>>>>>Wait what??? Seriously?
>>>>>
>>>>>a) Proper error handling will shield your from "Email taking down your app".
>>>>>b) Anything, just about anything is better than a Windows Service given the nightmare of administration and installation/updating
>>>>>c) Standalone Exes are un-managed (as in no monitoring) so that's an even worse idea
>>>>>
>>>>>So...
>>>>>
>>>>>Email is hardly a 'dedicate a service to it' operation especially since Email already is an asynchronous operation that doesn't wait for a reply. You submit a message and you're done a second later. Worst case the server waits longer and you're tying up a thread (if you're not using Async) or a completion port. Hardly a problem. Error handling exists to deal with this both for connection failures and timeouts. Crying for a service to handle this is like a using a jackhammer to dig up a flower.
>>>>>
>>>>>If anything building a small application support Web API/Service that handles long running tasks asynchronously (that hopefully handles more than just sending emails) is the way to go if you really feel you need to isolate things.But please don't use Windows services except as a very last resort.
>>>>
>>>>Makes sense to me :-}
>>>>I suppose the best solution depends on the volume of emails being sent but I'd lean towards a dedicated *generalized* WebApi email handler ?
>>>
>>>By WebApi email handler do you mean a Web API application installed on the server and then your ASP.NET application calls this app passing it some email parameters (e.g. Recipient email address, body of email message, attachment)?
>>
>>Basically - yes. Of course if it is on the same site you could call it directly as an async operation as well......
>>Maybe let it log operations to a table and email the sender if a send failed ?
>
>Sorry for asking too many questions. When you are saying "call it directly" you mean call a class/method of the ASP.NET application that sends emails?

Yes. You could write the Email handling as a standard async method and call it directly from server side code but also provide a WebApi method which simply delegates the work to it...
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform