Maybe you should use await host.RunAsync( ) according to documentation. Also add async to Main, or create a new project that does not contain the Main function. (Do not select the "Do not use top-level statements" option).
A timeout was reached (60000 milliseconds) while waiting for the My Test Service service to connect.
Hi teams:
I created a Worker Service project using Visual Studio 2022.
I refer to this document to publish the project template and create a widows service.
https://learn.microsoft.com/zh-tw/dotnet/core/extensions/windows-service
But when starting the service I always get the error:
The My Test Service service failed to start due to the following error:
The service did not respond to the start or control request in a timely fashion.
A timeout was reached (60000 milliseconds) while waiting for the My Test Service service to connect.
But when debugging from Visual Studio or directly executing the exe file, the program execution is correct.
What is the problem?
Thanks.