IIS 7 and Above
Python(django) + PyRFC Connection() - HTTP Error 500.0 - Internal Ser...
Last post Jun 05, 2019 06:50 AM by Jalpa Panchal
May 31, 2019 03:17 AM|DEV_Beginner|LINK
I have issue with PyRFC connection to SAP by host on IIS 7
before I use PyRFC my application work fine and after I import PyRFC and Connect to Bapi Server IIS will show detail as below
HTTP Error 500.0 - Internal Server Error
c:\python27\python27.exe - The FastCGI process exited unexpectedly
Detailed Error Information:
Error Code 0xffffffff
Requested URL http://safety.svi.co.th:80/api_test/
Physical Path D:\safetystock\api_test\
Logon Method Anonymous
Logon User Anonymous
Request Tracing Directory C:\inetpub\logs\FailedReqLogFiles
and this is my code:
from pyrfc import Connection
conn = Connection(user='sapconnect', passwd='mypassword', ashost='myhost', sysnr='00', client='100')
When compiler run to line Connection() IIS will show error 500 but I try to run localhost on server application work fine.
I already added full permission to root project folder and root python folder but it not work.
I has been stuck in this problem for 3 days. Help me please
python 2.7 64 bit
May 31, 2019 04:53 AM|lextm|LINK
If PyRFC crashed Python processes, you should report to SAP, not here,
May 31, 2019 05:03 AM|DEV_Beginner|LINK
I think not PyRFC crashed because when I run in localhost it work fine. but run on IIS it crashed may be IIS can't find module Pyrfc
then I want to know how to add to pyrfc package to IIS (RFC SDK install at
Jun 03, 2019 06:19 AM|Jalpa Panchal|LINK
Could you tell us where is RFC SDK was installed? and which account is used by the application pool?
Jun 03, 2019 06:54 AM|DEV_Beginner|LINK
I install RFC SDK at C:\nwrfcsdk and already add C:\nwrfcsdk\lib in system environment but when I run application on IIS , the system displays
DLL load failed: The specified module could not be found so I tried to move the file sapnwrfc.dll to C:\Python27\Lib\site-packages\pyrfc and system shows error the same message as above (HTTP Error
500.0 - Internal Server Error)
I guess IIS can't connect to package from C:\nwrfcsdk\lib but I already add full permission to that folder ( IUSER )
I have no idea
Thank you for reply
Jun 03, 2019 07:31 AM|Jalpa Panchal|LINK
Could you share C:\nwrfcsdk\lib folder permission and iis application pool snapshot?
Jun 03, 2019 07:41 AM|DEV_Beginner|LINK
Please see snapshot at
folder permission -> https://ibb.co/fxNTKjc
application Pool in IIS -> https://ibb.co/tmdXpP6
I don't know how to add image to this forums
Jun 03, 2019 08:08 AM|Jalpa Panchal|LINK
You could use this link https://imgur.com/upload to post the image in this forum.
You could also refer below post solution to resolve the issue.
Jun 03, 2019 08:19 AM|DEV_Beginner|LINK
Thank you for suggestion to upload image
from stack overflow I've read that post, but I can't understand how to do it. I tried to add full permission all related folder but not work
If you understand that post, please explain to me how to make it thoroughly.
Jun 03, 2019 08:32 AM|Jalpa Panchal|LINK
Select the application pool and then select iis application pool advance setting.
In advance setting check application pool identity:
Try to use
Process Monitor to monitor w3wp.exe IIS worker process and python.exe after calling the API.
dependency walker to track the dependent dll.
Jun 03, 2019 08:59 AM|DEV_Beginner|LINK
OK I've check application pool identity in advance setting
and use procmon to monitor w3wp.exe and python.exe process
look like system find sapnwrfc.dll from all related folder but not find in C:\nwrfcsdk\lib folder
How to add this folder to system finder ?
(and again I've upload image at imgur.com and can't input embed code to this site
Jun 03, 2019 09:11 AM|Jalpa Panchal|LINK
Check that dll is available in that folder or not and what is the error message shown at your application?could you share that detail error message snapshot?
Jun 03, 2019 09:45 AM|DEV_Beginner|LINK
Now I have moved the sapnwrfc.dll file to C:\Python27\Lib\site-packages\pyrfc\sapnwrfc.dll and system found it
Then I look at procmon again and find path C:\Python27\Lib\site-packages\pyrfc\sapnwrfc.dll.
Procmon show FILE LOCKED WITH ONLY READERS at
and result on web browser display error internal 500 when I call pyrfc connect function then I will look at permission on
C:\Python27\Lib\site-packages\pyrfc\sapnwrfc.dll it have full permission
(sapnwrfc.dll permission )
(Web browser display)
How to add read/write permission to sapnwrfc.dll from IIS ?
Jun 04, 2019 03:12 AM|Jalpa Panchal|LINK
Check that you configured python in iis properly or not? your python folder and site folder has iis_iusrs, iusr and application pool full access permmision. which authentication are you using to access the site?
Jun 04, 2019 05:43 AM|DEV_Beginner|LINK
I've checked python configuration in FastCGI Setting it work fine but I'm not sure if it's correct or not.
and I have granted access IUSER and IIS_IUSER for python folder , site folder with full permission and I don't know how to grant access for application pool
Jun 04, 2019 07:55 AM|Jalpa Panchal|LINK
You could give application pool permission to the folder by:
Please provides application pool identity setting as suggested in this step:
Also, run FRT in iis :
When you enable, you capture status code from 200-500 so all the request will be logged. Then you can try accessing the site and check what is wrong by checking FREB traces.
Jun 04, 2019 08:36 AM|DEV_Beginner|LINK
I gave application pool permission from IIS to site folder and python folder
Application Pool -> https://imgur.com/pxkDJOp
Folder Permission -> https://imgur.com/aW4t3YV
and track error log follow your suggestion and I receive error as below (What part of the information do I have to see?)
Jun 04, 2019 09:01 AM|Jalpa Panchal|LINK
If possible could you please upload log file on one drive and share a link?
Jun 04, 2019 09:13 AM|DEV_Beginner|LINK
Jun 05, 2019 06:50 AM|Jalpa Panchal|LINK
please check python log and share with us.