ASP.NET webpage on IIS Server does not call Python/run scripts at all

530 views Asked by At

I've developed an ASP.NET website on IIS (virtual Windows Server using Amazon Lightsail) which works as expected for the most part. But one issue with it is with running specialized Python scripts.

In my website, there is a feature where a user (of a certain account level) can upload an image, which is then passed through Python (through Process.Start). After Python does its thing, it sends text output back to the webpage. This works perfectly under the context of IIS Express in my local computer, but on the server, it seems to not run Python at all.

It is noted that I did not receive any warnings or errors. Seems to entirely skip the Process.Start segment.

I suspect that it is due to either of these:

  • Security access
  • The application pool
  • The Process.Start function

Things I tried:

  • Changing the security settings of the folder with the Python app and the scripts, as well as the Python executable
  • Changing the application pool of the website to LocalSystem
  • Disabled dynamic compression
  • Added a script map for the Python app
  • Reinstalled Python from Users/Administrator/Local/Appdata... to C:/Python (also changed the required paths in the website code behind) I also made sure that I installed the right Python libraries for the code to work.

Apart from the file paths in the code behind, nothing is changed in the actual ASP.NET website and DLL. Ideally I should not need to change anything else with regards to the website.

The website still does not call Python. I've been scratching my head for the past two days on this single issue.

Also, the folder where the Python scripts and related files are located are within wwwroot.

Any suggestions are much appreciated.

TL;DR: ASP.NET website that calls Python to run an already-coded script as part of its function works great under IIS Express. Python does not run when called under IIS Server.

0

There are 0 answers