简体   繁体   中英

Nservicebus hosted as a service shutdown immediately after starting

I have written a service to host NServiceBus and for some reason NServiceBus is shutting down almost immediately after starting the service. If I run the executable manually everything works exactly as it should but as a service it decides to shutdown without an error being logged. Below is an example of the log files:

  1. Selected active license from C:\\ProgramData\\ParticularSoftware\\license.xml
  2. Security warnings are reported due to opening up some of the security for testing purposes
  3. Initiating shutdown.
  4. Shutdown complete.

All of this takes place in 0.48 seconds.

This is a .net 4.6.1 application as my organization doesn't allow .net core at this point.

I have finally figured out the answer, I had 2 separate ways of closing the connection with NServiceBus, one was supposed to be used in the case that it was being ran as a console app, while the other was for when a service was running. The problem was that the one for the console app was also being hit by the service before it was supposed to, I have now resolved that issue.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM