问题
I've created an email notification console application using mailkit's idleClient sample code (https://github.com/jstedfast/MailKit/tree/master/samples/ImapIdle). The purpose of this application is to fetch all new emails and trigger web api's based on the content of the email. It works fine as a console application.
But when I converted it into a windows service using Topshelf and hosted it in a server environment, the protocol logger is not able to write anything to the logs and the onCount_changed event is not triggered. But the same application works if I directly run the exe file on the server using "Run as Administrator".
Any leads on how to make the windows service work with mailkit. The mail server used is our company's internal mail server. I'm using Console.Readline() to keep the task listening for new mail notifications. Is that the reason for it failing ?
来源:https://stackoverflow.com/questions/58693726/mailkit-imapclient-working-with-console-application-but-not-working-as-windows-s