简体   繁体   English

IIS 7中python中的ASP提供HTTP / 1.1 500服务器错误

[英]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. 我不是以管理员身份而是以用户身份使用Windows 7和IIS 7。 I have installed asp module and cgi module in IIS 7 in application development feature. 我已经在IIS 7中的应用程序开发功能中安装了asp模块和cgi模块。 My simple classic asp page is working which is : 我简单的经典ASP页面正在工作,它是:

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

My cgi in python is working which is : 我在python中的cgi正在工作,它是:

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 : 但是当我在asp页面中使用python脚本时,它显示HTTP / 1.1 500服务器错误我正在使用的代码是:

<%@Language=Python%>

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

I have searched the net for 4 days but didnt get any luck. 我已经在网上搜索了4天,但没有得到任何运气。 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. 我在身份验证中启用了“匿名身份验证”,未注册并为ASP注册了pyscript.py,向python提供了IUSR并给予了IUSR完全控制权,为True启用了“启用32位应用程序”无效。

Finally I found the solution to it. 最后,我找到了解决方案。

The steps to be performed are 要执行的步骤是

  1. Register Python with ASP: 用ASP注册Python:

    • Open Command Prompt 打开命令提示符
    • Go to {python_installation_dir}\\Lib\\site-packages\\win32comext\\axscript\\client 转到{python_installation_dir}\\Lib\\site-packages\\win32comext\\axscript\\client
    • Run python pyscript.py 运行python pyscript.py
  2. Enable 32-bit application for IIS7 为IIS7启用32位应用程序

    • Go to IIS7 转到IIS7
    • Right click on your site's application pool 右键单击您站点的应用程序池
    • Select Advanced Settings 选择高级设置
    • Under General , set Enable 32-Bit Application to True 在“ 常规”下 ,将“ 启用32位应用程序”设置True
  3. Add IIS_IUSRS , IUSR or USERS to your virtual directory: IIS_IUSRSIUSRUSERS添加到您的虚拟目录中:

    • Right click on the directory 右键单击目录
    • Click Edit Permission 单击编辑权限
    • Select the Security tab. 选择安全选项卡。
    • Give the account at least read permissions. 至少授予该帐户读取权限。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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