I have a Windows Server 2019, running IIS. I use WFASTCGI to serve my Flask apps according to a specific IP and port (for instance 151.80.60.225:5000), and my web.config file works well. However, I want to serve multiple apps on the same IP:port (151.80.60.225:5000) using /routes like that:
151.80.60.225:5000/ ==> Home
------> 151.80.60.225:5000/app1 ==> App1
------> 151.80.60.225:5000/app2 ==> App2
------> 151.80.60.225:5000/app3 ==> App3
------> 151.80.60.225:5000/app4 ==> App4
I create a pool in IIS with an apps website, hosting itself app1 website, app2 website,...
I have a web.config for each file and the structure is like this:
<configuration>
<system.webServer>
<handlers>
<add name="Python FastCGI"
path="*"
verb="*"
modules="FastCgiModule"
scriptProcessor="c:\users\administrator\appdata\local\programs\python\python39\python.exe|c:\users\administrator\appdata\local\programs\python\python39\lib\site-packages\wfastcgi.py"
resourceType="Unspecified"
requireAccess="Script" />
</handlers>
</system.webServer>
<appSettings>
<!-- Required settings -->
<add key="WSGI_HANDLER" value="__init__.app" />
<add key="PYTHONPATH" value="C:\apps\app1\app" />
<!-- Optional settings -->
<add key="WSGI_LOG" value="C:\apps\logs\app1.log" />
</appSettings>
</configuration>
So I have a WFASTCGI web.config file for MES app (like a homepage) and WFASTCGI web.config file for each app. But when I go to 151.80.60.225:5000/app1, I have a "not found error page".
My question is: What is a good way to structure a portal like I want to do?
Thanks for your help.
Edit on January 22:
I follow your tip, but I have still the 404 not found page.
My settings are below, anything is wrong?
Furthermore, I authorize DefaultAppPool to full access to the directory, and test settings is fine.
Edit on January 23: Please find below the FailedReqLogFile with sub status code 0 and error code 404:
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
<System>
<Provider Name="WWW Server" Guid="{3A2A4E84-4C21-4981-AE10-3FDA0D9B0F83}"/>
<EventID>0</EventID>
<Version>1</Version>
<Level>3</Level>
<Opcode>16</Opcode>
<Keywords>0x100</Keywords>
<TimeCreated SystemTime="2021-01-23T09:39:47.068Z"/>
<Correlation ActivityID="{80000036-0000-E300-B63F-84710C7967BB}"/>
<Execution ProcessID="11112" ThreadID="12496"/>
<Computer>WIN-xxxxxx</Computer>
</System>
<EventData>
<Data Name="ContextId">{80000036-0000-E300-B63F-84710C7967BB}</Data>
<Data Name="ModuleName">FastCgiModule</Data>
<Data Name="Notification">128</Data>
<Data Name="HttpStatus">404</Data>
<Data Name="HttpReason">NOT FOUND</Data>
<Data Name="HttpSubStatus">0</Data>
<Data Name="ErrorCode">0</Data>
<Data Name="ConfigExceptionInfo"></Data>
</EventData>
<RenderingInfo Culture="fr-FR">
<Opcode>MODULE_SET_RESPONSE_ERROR_STATUS</Opcode>
<Keywords>
<Keyword>RequestNotifications</Keyword>
</Keywords>
<freb:Description Data="Notification">EXECUTE_REQUEST_HANDLER</freb:Description>
<freb:Description Data="ErrorCode">The operation completed successfully.
(0x0)</freb:Description>
</RenderingInfo>
<ExtendedTracingInfo xmlns="http://schemas.microsoft.com/win/2004/08/events/trace">
<EventGuid>{002E91E3-E7AE-44AB-8E07-99230FFA6ADE}</EventGuid>
</ExtendedTracingInfo>
</Event>
You don't need to assign one port for each app. Just assign one port for the portal.
For example, when you add site "MES", assign port 5000 to it and you can access it through localhost:5000.
Then add app1, you will see this interface. Set alias(assuming that it is "app1") and change another application pool. It is important to assign each application to one application pool.
After adding success, you can access app1 through "localhost:5000/app1". Same operation for app2 and app3.
If it still return error 404, first check the log in IIS to get the status code and sub status code. Sub status code will provide more detailed information.
Enable fail request tracing can collect tracing about request so that you will know what caused the issue.