Mailkit imapclient working with console application but not working as windows service

一笑奈何 提交于 2021-02-11 12:35:46

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!