updated
This commit is contained in:
165
windows_print_service/TROUBLESHOOTING_1053.md
Normal file
165
windows_print_service/TROUBLESHOOTING_1053.md
Normal file
@@ -0,0 +1,165 @@
|
||||
# Windows Print Service - Error 1053 Troubleshooting Guide
|
||||
|
||||
## 🚨 Windows Service Error 1053 - "Service did not respond to start or control request"
|
||||
|
||||
This error occurs when Windows services don't communicate properly with the Service Control Manager (SCM). Here's how to fix it:
|
||||
|
||||
### 🔧 SOLUTION 1: Use the Enhanced Service Package
|
||||
|
||||
**Problem**: The original service wasn't designed for Windows service requirements.
|
||||
**Fix**: Updated service architecture with proper Windows service communication.
|
||||
|
||||
#### New Files Included:
|
||||
- ✅ `service_wrapper.py` - Handles Windows service communication
|
||||
- ✅ `print_service_complete.py` - Enhanced with signal handling and proper shutdown
|
||||
- ✅ `test_service.bat` - Test service in standalone mode before installing
|
||||
|
||||
### 🧪 STEP-BY-STEP TROUBLESHOOTING:
|
||||
|
||||
#### Step 1: Test Service in Standalone Mode
|
||||
```cmd
|
||||
# Run this to test the service before installing as Windows service
|
||||
test_service.bat
|
||||
```
|
||||
|
||||
If this works, the service code is fine. If not, check the logs.
|
||||
|
||||
#### Step 2: Check Python and Dependencies
|
||||
```cmd
|
||||
# Verify Python embedded is working
|
||||
cd C:\QualityPrintService\python_embedded
|
||||
python.exe --version
|
||||
|
||||
# Test the service script directly
|
||||
python.exe ..\print_service_complete.py --test
|
||||
```
|
||||
|
||||
#### Step 3: Install with Enhanced Wrapper
|
||||
The installer now creates a service wrapper that properly communicates with Windows SCM:
|
||||
|
||||
```cmd
|
||||
# Uninstall old service
|
||||
sc stop QualityPrintService
|
||||
sc delete QualityPrintService
|
||||
|
||||
# Reinstall with enhanced wrapper
|
||||
install_service_complete.bat
|
||||
```
|
||||
|
||||
#### Step 4: Manual Service Control
|
||||
```cmd
|
||||
# Start service manually to see error details
|
||||
net start QualityPrintService
|
||||
|
||||
# Check service status
|
||||
sc query QualityPrintService
|
||||
|
||||
# View service logs
|
||||
type "%USERPROFILE%\PrintService\logs\service_wrapper_*.log"
|
||||
```
|
||||
|
||||
### 🔍 DIAGNOSTIC COMMANDS:
|
||||
|
||||
#### Check Service Installation:
|
||||
```cmd
|
||||
sc query QualityPrintService
|
||||
sc qc QualityPrintService
|
||||
```
|
||||
|
||||
#### Check Port Availability:
|
||||
```cmd
|
||||
netstat -an | findstr :8765
|
||||
```
|
||||
|
||||
#### Test HTTP Endpoints:
|
||||
```cmd
|
||||
curl http://localhost:8765/health
|
||||
# OR
|
||||
powershell Invoke-WebRequest -Uri "http://localhost:8765/health"
|
||||
```
|
||||
|
||||
### 📋 COMMON SOLUTIONS:
|
||||
|
||||
#### Solution A: Port Already in Use
|
||||
```cmd
|
||||
# Find process using port 8765
|
||||
netstat -ano | findstr :8765
|
||||
# Kill process if needed (replace PID)
|
||||
taskkill /PID <PID_NUMBER> /F
|
||||
```
|
||||
|
||||
#### Solution B: Python Path Issues
|
||||
```cmd
|
||||
# Verify Python embedded path in service wrapper
|
||||
type "C:\QualityPrintService\service_wrapper.bat"
|
||||
```
|
||||
|
||||
#### Solution C: Permissions Issues
|
||||
```cmd
|
||||
# Run installer as Administrator
|
||||
# Right-click install_service_complete.bat → "Run as administrator"
|
||||
```
|
||||
|
||||
#### Solution D: Service Recovery
|
||||
```cmd
|
||||
# Configure automatic recovery
|
||||
sc failure QualityPrintService reset= 86400 actions= restart/5000/restart/5000/restart/5000
|
||||
```
|
||||
|
||||
### 📊 SERVICE STATUS VERIFICATION:
|
||||
|
||||
#### Successful Service Start:
|
||||
- Service Status: RUNNING
|
||||
- HTTP Response: `{"status": "healthy", "service": "Windows Print Service"}`
|
||||
- Log Shows: "Service is ready and listening..."
|
||||
|
||||
#### Failed Service Start:
|
||||
- Service Status: STOPPED or START_PENDING
|
||||
- HTTP Response: Connection refused
|
||||
- Log Shows: Error messages with specific details
|
||||
|
||||
### 🛠️ ADVANCED TROUBLESHOOTING:
|
||||
|
||||
#### Enable Debug Logging:
|
||||
Edit the service script to increase logging level:
|
||||
```python
|
||||
logging.basicConfig(level=logging.DEBUG)
|
||||
```
|
||||
|
||||
#### Manual Service Wrapper Test:
|
||||
```cmd
|
||||
cd C:\QualityPrintService
|
||||
python_embedded\python.exe service_wrapper.py
|
||||
```
|
||||
|
||||
#### Windows Event Viewer:
|
||||
1. Open Event Viewer
|
||||
2. Navigate: Windows Logs → Application
|
||||
3. Filter by Source: Service Control Manager
|
||||
4. Look for QualityPrintService errors
|
||||
|
||||
### 📞 SUPPORT CHECKLIST:
|
||||
|
||||
Before reporting issues, please verify:
|
||||
|
||||
- [ ] ✅ Python embedded is working (`python_embedded\python.exe --version`)
|
||||
- [ ] ✅ Service runs in standalone mode (`test_service.bat`)
|
||||
- [ ] ✅ Port 8765 is available (`netstat -an | findstr :8765`)
|
||||
- [ ] ✅ Installer was run as Administrator
|
||||
- [ ] ✅ Windows is Windows 10/11 or Server 2016+
|
||||
- [ ] ✅ Service logs show specific error messages
|
||||
|
||||
### 🎯 EXPECTED RESULTS:
|
||||
|
||||
After following this guide:
|
||||
|
||||
1. **Service Status**: RUNNING
|
||||
2. **Health Check**: http://localhost:8765/health returns JSON response
|
||||
3. **Chrome Extension**: Detects service and shows "Windows Service" mode
|
||||
4. **Printing**: Silent PDF printing works without dialogs
|
||||
|
||||
---
|
||||
|
||||
**Package Version**: Zero Dependencies Complete
|
||||
**Last Updated**: September 2025
|
||||
**Support**: Check service logs in `%USERPROFILE%\PrintService\logs\`
|
||||
Reference in New Issue
Block a user