-
Notifications
You must be signed in to change notification settings - Fork 9.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to get startup parameters when windows service starts #9777
Comments
How are you verifying that you don't get the args in Program.Main? |
I believe OnStart has args. They don’t get passed into main |
So it does: |
@davidfowl I need to get the command line parameters in Main, as the parameters needed for the program initialization, it is too late to get the parameters in OnStart, it means nothing to me. |
@Tratcher Yes, this is not reasonable, it is right to get the parameters when the program starts. |
Here's an interesting thread: There are two places to put parameters:
There's nothing for us to do here, this is just how Windows Services work. Can you try the image path approach? |
Closing this as we haven't heard from you and generally close issues with no response after ~7 days. Please feel free to comment if you're able to get the information we're looking for and we can reopen the issue to investigate further! |
If you believe you have an issue that affects the security of the platform please do NOT create an issue and instead email your issue details to secure@microsoft.com. Your report may be eligible for our bug bounty but ONLY if it is reported through email.
Describe the bug
A clear and concise description of what the bug is.
After deploying the asp.net core project as a windows service, I started the project with (Get-Service "ServiceName").Start(@("--tag=dev")), but the args parameter in the Program.Main method is not. Get "--tag=dev", what is the reason?
To Reproduce
Steps to reproduce the behavior:
Expected behavior
A clear and concise description of what you expected to happen.
Screenshots
If applicable, add screenshots to help explain your problem.
Additional context
Add any other context about the problem here.
Include the output of
dotnet --info
The text was updated successfully, but these errors were encountered: