0

I have Flask web app that im trying to publish on azure. I deployed it on web app, Created new resource, downloaded user publish profile and published it from visual studio using the downloaded file. Everything runs smoothly on localhost but once published im getting error:

  • IIS received the request; however, an internal error occurred during the processing of the request. The root cause of this error depends on which module handles the request and what was happening in the worker process when this error occurred.
  • IIS was not able to access the web.config file for the Web site or application. This can occur if the NTFS permissions are set incorrectly.
  • IIS was not able to process configuration for the Web site or application.
  • The authenticated user does not have permission to use this DLL.
  • The request is mapped to a managed handler but the .NET Extensibility Feature is not installed.

I have little to no knowledge what this means. This is my very first web to publish so im pretty newbie.

My project has following structure. enter image description here

My Views.py calls senna-win32.exe with the following code:

 senna_path = os.path.join('senna\\senna-win32.exe')
 p = subprocess.Popen(senna_path, stdout=subprocess.PIPE,stdin=subprocess.PIPE)
 grep_stdout = p.communicate(input=bytes(va, 'utf-8'))[0]
 inList = grep_stdout.decode()
 inList = list(inList.splitlines())

It seems to have no issues/errors on my localhost but not sure whats going on azure.

scorpion5211
  • 1,020
  • 2
  • 13
  • 33
  • How did you deploy your app? Please edit your question accordingly. – David Makogon Jan 21 '17 at 23:55
  • i added new resource, downloaded publish profile and published it from visual studio using publish profile file. Is this what you were asking? – scorpion5211 Jan 22 '17 at 00:24
  • Nope not what I was asking (and I also asked you to *edit your question* rather than posting additional details in comments). Did you deploy to a cloud service? to a web app? if a web app, how did you initially create it? Basically all the details of how you deployed and which Azure service you used). – David Makogon Jan 22 '17 at 00:28
  • I apologize, i updated the post with the info. I think thats pretty detailed, i can take a screenshot of the resource if necessary as well, or whatever else info is needed. – scorpion5211 Jan 22 '17 at 00:40
  • Possible duplicate of [Running .exe on Azure](http://stackoverflow.com/questions/41841339/running-exe-on-azure) – PythonTester Mar 15 '17 at 15:07

2 Answers2

2

Per my experience, there are many reasons which will cause the issue like yours.

For the first case, some Python packages required in the reqirements.txt file are not directly installed on Azure WebApp. For this case, you need to follow the offical toturial for troubleshooting to solve it. Or even, you can try to follow my solution for the other SO thread Publishing MVC app that uses python script to solve it.

However, I think your issue might be caused by the senna_path in your code is not a valid path on Azure WebApp. I tried to create a simple Python script as below to test your code using Kudu console on Azure WebApp, it works fine via command python test.py > test.out.txt.

import os
from subprocess import Popen, PIPE

path = os.path.join('senna-win32.exe')
p = Popen(path, stdin=PIPE, stdout=PIPE)
grep_stdout = p.communicate(input="happy time".encode('utf-8'))[0]
inList = grep_stdout.decode()
inList = list(inList.splitlines())
print inList

So my suggestion is that try to use the absolute path D:\home\site\wwwroot\FlaskWebProject1\senna\senna-win32.exe instead of senna\senna-win32.exe for your app to solve the issue.

Any update, please feel free to let me know.

Community
  • 1
  • 1
Peter Pan
  • 23,476
  • 4
  • 25
  • 43
  • 1
    i turned custError off, looked in eventLog.xml and saw a bit more descriptive error that was complaining about the path. Changed it to full path and that specific error is gone. Now im facing issue thats complaining about microsoft.cis.query not laoding in right format, but ill post that in different question if i cant solve it. You answered my initial question thank you! – scorpion5211 Jan 23 '17 at 14:14
0

I had the same issue, in my case the problem was missing redirection of the stderr, same as your code I redirected only stdout+stdin.

Adding stderr=PIPE solved my problem.

process = Popen(exe_relative_path, stdin=PIPE, stdout=PIPE, stderr=PIPE)  
Ali Yılmaz
  • 1,657
  • 1
  • 11
  • 28