Windows service locks up on assembly load

痴心易碎 提交于 2019-12-06 04:35:40

The assembly was taking 45 seconds to connect, it tries to connect to the internet to verify something about the assembly before loading it, but on that particular machine it's blocked by the firewall. After 30 seconds of trying to start, Windows service manager gives up and kills the process.

Moving the loading of the assembly until after the service has been started allowed it to start up properly (although with a 45 second delay before it starts responding).

It looks like it was related to generating publisher evidence. From here http://msdn.microsoft.com/en-us/library/bb629393.aspx:

We recommend that services use the element to improve startup performance. Using this element can also help avoid delays that can cause a time-out and the cancellation of the service startup.

Putting the following in the app.config file got rid of the delay:

<configuration>
    <runtime>
        <generatePublisherEvidence enabled="false"/>
    </runtime>
</configuration>

Are you doing things on module load while holding the loader lock?

See this article for debugging: http://msdn.microsoft.com/en-us/library/ms172219.aspx

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