Reputation: 1
I have multiple applications with similar python flask app script to host in IIS\Default Web Site. Only firstly create Application is working as expected and unfortunately, other subsequent flask app are not running.
When recycle the respective appPool, I have got following error only in event viewer.
Log Name: Application
Source: HttpPlatformHandler
Date: 10/27/2023 3:46:44 PM
Event ID: 1000
Task Category: None
Level: Error
Keywords: Classic
User: N/A
Computer:
Description:
The description for Event ID 1000 from source HttpPlatformHandler 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:
Process '10260' failed to start. Port = 20173, Error Code = '-2147023436'.
Event Xml:
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
<System>
<Provider Name="HttpPlatformHandler" />
<EventID Qualifiers="0">1000</EventID>
<Level>2</Level>
<Task>0</Task>
<Keywords>0x80000000000000</Keywords>
<TimeCreated SystemTime="2023-10-27T10:16:44.326060800Z" />
<EventRecordID>1926695</EventRecordID>
<Channel>Application</Channel>
<Computer>BAVNAPPCNV01.PEARL.COM</Computer>
<Security />
</System>
<EventData>
<Data>Process '10260' failed to start. Port = 20173, Error Code = '-2147023436'.</Data>
</EventData>
</Event>
web.config file
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<httpPlatform processPath="D:\Program Files (x86)\Utilities\report\report\env\Scripts\python.exe" arguments="-m flask run --port 4001">
<environmentVariables>
<environmentVariable name="FLASK_APP" value="report.py" />
</environmentVariables>
</httpPlatform>
<handlers>
<add name="reportHttpPlatformHandler" path="*" verb="*" modules="httpPlatformHandler" scriptProcessor="D:\Program Files (x86)\Utilities\report\report\env\Scripts\python.exe" resourceType="Unspecified" />
</handlers>
</system.webServer>
</configuration>
I have tried uninstalling and re-install httpPlatformHandler and even restart the server.
Upvotes: -1
Views: 770
Reputation: 63203
@app.route('/app1/hello')
should work for you, because
/app1
under a site./app1/hello
to the Python/Flask side.I don't think @app.route('app1/hello')
worked for you, as missing the /
should trigger a 502.5 error.
Upvotes: 0
Reputation: 12749
Try to reinstall the http handler, use below web.config file:
<configuration>
<system.webServer>
<handlers>
<add name="httpPlatformHandler" path="*" verb="*" modules="httpPlatformHandler" scriptProcessor="" resourceType="Unspecified" requireAccess="Script" />
</handlers>
<httpPlatform processPath="C:\Python311\python.exe" arguments="-m flask run --port %HTTP_PLATFORM_PORT%" startupTimeLimit="20" stdoutLogEnabled="true" stdoutLogFile=".\test.log">
</httpPlatform>
</system.webServer>
</configuration>
assign iis_iusrs and iusr full control permission to the site root folder and python folder where the python exe file located.
Upvotes: -1