Saturday, March 24, 2012

Web Service or Windows Service

I'm kinda new to asp.net but I've got a web site that needs to send emails to lots of users at any given moment the administrator wants... it goes like this...

Choose the groups

Check for the users withing the group A,B,C....

Send email...

It takes a lot of time waiting for the process to finish, and I don't want the administrator to sit there the time it takes, so I was wondering if i could use a web service to make all of this happen without the user waiting for the page to refresh, like making a job pool and calling the web service to execute the jobs independently... This process should not return any data to the web page

I don't know if this is possible, I just need to call a process and if the user wants to close the browser, the process must be running within the web service...

If a web service cannot give me that kind of functionality, I know a windows service can, but I don't know how to make the windows service to execute the job i've assigned to it with an asp button click, so far i have found examples of how to execute windows service with its timer, but i need it on demand...

If you could tell me which one is better o which one is possible or whatever helps me thank you

I suspect your time isn't related to the application, but both your code to check the groups and the fact that you're using the built-in SMTP server, which is no speed demon.

Jeff


You should be able to use a web service to get what you want. There are two ways to call a web service function -- either normally, which would return values to the browser (as defined by the service), or you can run the function async. (The web reference to the service creates the async method automatically.)

The web service would be better if you want to use a browser-- there's nothing separate to install, and no configuring the .net runtime security (to access something on the OS like a service). You DO need to worry about other types of security, like who do you want accessing your web service and how should you detect who's accessing it? Web services are public by nature, but you don't want just anyone starting the job routine.

0 comments:

Post a Comment