Skip to content
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

Error on hosting a FastAPI Application with Windows Service #2355

Open
frankwwu opened this issue Aug 5, 2024 · 0 comments
Open

Error on hosting a FastAPI Application with Windows Service #2355

frankwwu opened this issue Aug 5, 2024 · 0 comments

Comments

@frankwwu
Copy link

frankwwu commented Aug 5, 2024

Description:
There is an issue with pywin32 v306 when hosting a FastAPI application with Windows Service. The problem manifests differently depending on the Python version used, but I need to get the feature works with Python 3.12 or higher.

Environment:
• Windows 11
• pywin32 version: 306
• Python versions tested: 3.9, 3.12

Steps to Reproduce:

  1. Create a FastAPI application (demo code attached). main.zip
  2. Install pywin32 v306, and necessary Python libraries.
  3. Host the application with Python 3.12 (or Python 3.9 for comparison)

Observed Behavior:

Python Version Start Command Error Stop Command Error Web Browser Behavior
3.9 None None localhost refused to connect
3.12 Error starting service: The service did not respond to the start or control request in a timely fashion. Error stopping service: The service has not been started. (1062)

Expected Behavior:
The FastAPI application should start and be accessible via localhost without errors for both Python 3.9 and 3.12.

Additional Information:

  • With Python 3.9, the application installs, starts, and stops without errors, but it is not accessible, maybe is not actually hosted.
  • With Python 3.12, the start command results in an error, and the hosting is failed.

Messages in the Event Viewer:

The description for Event ID 14 from source Python Service cannot be found. Either the component that raises this event is not installed on your local computer or the installation is corrupted. You can install or repair the component on the local computer.

If the event originated on another computer, the display information had to be saved with the event.

The following information was included with the event:

RuntimeError: servicemanager.file could not be loaded - win32 error code is 193

The specified resource type cannot be found in the image file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant