You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
Create a FastAPI application (demo code attached). main.zip
Install pywin32 v306, and necessary Python libraries.
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
The text was updated successfully, but these errors were encountered:
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:
Observed Behavior:
Expected Behavior:
The FastAPI application should start and be accessible via localhost without errors for both Python 3.9 and 3.12.
Additional Information:
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
The text was updated successfully, but these errors were encountered: