Having doubts over windows service
Hello everyone,
Can any one tell me when we go to develop a windows service what role does the service account play? If i give account of the computer administrator what can be the drawbacks??? What is the difference between Local system account and administartor account(in terms of privileges)??? Thanks in advance,
Hirendra SisodiyaPosted Apr 26, 2010, 2:29 AM
i think you will have been solved your problem....
i have also same problem like you when i use outlook library in wiondows service...do you have any idea about it????
thanks
Sunil SachdevaPosted Nov 30, 2009, 1:17 AM
hey Piotr, I, not only have to send emails but have to read them as well as u can see thru my code that m gaining access to the inbox folder also.:)
This is why i have 2 use outlook.
Thanks
Piotr JustynaPosted Nov 29, 2009, 3:27 PM
To be honest I have no idea what's wrong with your code.
I remember that one of your main concerns was to develop a windows service able to send emails. I wonder why do you need Outlook to do that. If I were you I would avoid using Outlook and just send mails using the easiest possible way: one of the .NET framework's SMTP wrapper classes. This is really easy and you can find tons of samples over the Internet (for example here).
I hope this will help you and if it will, please mark my answer as helpful.
Cheers!
Sunil SachdevaPosted Nov 29, 2009, 7:10 AM
error does not occur at random places.by saying that error is not fixed what i mean to say is error occurs at different lines of code but i believe its due to same reason.
obj2 = new Microsoft.Office.Interop.Outlook.Application();this line of code is the root.
1st of all error will occur at this line and that is error from some com library
then if this line gets away then their is a property or component of this application object "obj2" i.e. AnswerWizard(property) .
it throws some interop.com exception. nad when this exception occurs it does not stop the execution at obj creation but it does come into play when i try to get the access to inbox folder the outlook i.e this line of code:
inboxFolder = ns.GetDefaultFolder(Microsoft.Office.Interop.Outlook.OlDefaultFolders.olFolderInbox);and the exception is: Can not perform operation you are not connected and i'm not having a clue what that error means as i've not found anything about it on google as well
Piotr JustynaPosted Nov 29, 2009, 6:41 AM
I found your code at social.msdn.microsoft.com (I believe it's your case :) ). If you have the error appearing in random places, you should first lock your objects to make your debugging easier. I would suggest writing something like this:
Or lock whatever you wish following this article.
Please debug it carefully and tell me the news :) I'm happy to help and curious about the answer.
Cheers!
Sunil SachdevaPosted Nov 29, 2009, 5:51 AM
Piotr JustynaPosted Nov 29, 2009, 5:25 AM
Have you included proper Office interop library?
Cheers!
Sunil SachdevaPosted Nov 28, 2009, 11:28 PM
Sunil SachdevaPosted Nov 28, 2009, 11:16 PM
Piotr JustynaPosted Nov 28, 2009, 5:09 PM
Cheers!
Sunil SachdevaPosted Nov 28, 2009, 11:57 AM
Piotr JustynaPosted Nov 28, 2009, 10:17 AM
Yes, you obviously can open installed software using Windows Services. Please find a similar problem solved here. I believe, that you can use any account with privilege to execute applications.
If you like my answer please mark it as helpful :)
Cheers!
Sunil SachdevaPosted Nov 28, 2009, 7:39 AM
Piotr JustynaPosted Nov 28, 2009, 7:18 AM
If you're developing the service for yourself and for your own machine, I see no problem using the Admin account. The main concern is always: "does the client want the service to be allowed to do everything on his machine?". And you have to keep that in mind. It's always best to think about possible actions (file access, granting privileges, AD operations) which your service will perform and then create an appropriate account with only that set of privileges.
Please find here a discussion concerning your question.
I hope this helps, please keep me informed!