简体   繁体   中英

Asp in python in IIS 7 is giving HTTP/1.1 500 Server Error

I am using Windows 7 and IIS 7 not as administrator but as a user. I have installed asp module and cgi module in IIS 7 in application development feature. My simple classic asp page is working which is :

<%response.write("Hello World")%>

My cgi in python is working which is :

print "Content-Type: text/plain;charset=utf-8"
print "Hello World!"

But when I am using python script inside asp page it is showing HTTP/1.1 500 server error The code I am using is :

<%@Language=Python%>

<%
x="Hello"
response.write(x)
%>

I have searched the net for 4 days but didnt get any luck. I enabled “Anonymous Authentication” in Authentication ,Unregistered and registered the pyscript.py for ASP, Provided python with IUSR and gave IUSR full control,Enabled “Enable-32 Bit Application” to True didnt worked.

Finally I found the solution to it.

The steps to be performed are

  1. Register Python with ASP:

    • Open Command Prompt
    • Go to {python_installation_dir}\\Lib\\site-packages\\win32comext\\axscript\\client
    • Run python pyscript.py
  2. Enable 32-bit application for IIS7

    • Go to IIS7
    • Right click on your site's application pool
    • Select Advanced Settings
    • Under General , set Enable 32-Bit Application to True
  3. Add IIS_IUSRS , IUSR or USERS to your virtual directory:

    • Right click on the directory
    • Click Edit Permission
    • Select the Security tab.
    • Give the account at least read permissions.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM