I've setup a Windows Server2016 virtual machine, and installed IIS with CGI, ISAPI, .Net, etc... My only ambition for this server is to run python scripts the old CGI way: python file requested, executes in a separate new process, done.
I added a script mapping as suggested in a range of tutorials. I made sure to setup ISAPI filters and CGI restrictions accordingly. I still can't seem to solve the 404.2 I am getting. Clearly, the mapping is found, the test.py file exists, and I've opened the file system to "everyone" in "full control" to be sure that it is not the issue.
In ISAPI and CGI restrictions, I've tried different formats: with and without %s %s, with and without quotes, etc...
I've tried using that python.exe command on my scripts locally, it runs fine. Something is up with IIS and can't figure it out.
Browsing the root folder from the web browser works and lists .py files successfully.
Error while browsing from localhost
Web config for the custom site, showing the python script mapping
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<handlers accessPolicy="Read, Execute, Script">
<add name="Python" path="*.py" verb="*" modules="CgiModule" scriptProcessor="C:\Anaconda3\python.exe %s %s" resourceType="Either" requireAccess="Script" />
</handlers>
<directoryBrowse enabled="true" />
</system.webServer>
</configuration>