运行ASP.NET程序时发生HTTP 500 内部服务器错误

liubin314616 2003-03-24 02:58:53
各位高手,快救救小弟,我运行程序时总出现HTTP 500 内部服务器错误,我查了有关资料,但运行.asp和.htm文件又可以,不知道是什么缘故,各位高手不吝赐教哦。
...全文
172 18 打赏 收藏 转发到动态 举报
写回复
用AI写文章
18 条回复
切换为时间正序
请发表友善的回复…
发表回复
saucerman 2003-04-05
  • 打赏
  • 举报
回复
任何ASP都行
而任何ASP .net都不行!
zwztu 2003-04-03
  • 打赏
  • 举报
回复
IIS5 HTTP500内部错误解决办法

 一.错误表现

IIS5的HTTP 500内部服务器错误是我们经常碰到的错误之一,它的主要错误表现就是ASP程序不能浏览但HTM静态网页不受影响。另外当错误发生时,系统事件日志和安全事件日志都会有相应的记录。

具体如下:


(一)IE中的表现


当浏览以前能够正常运行的asp页面时会出现如下的错误:


网页无法显示

您要访问的网页存在问题,因此无法显示。

请尝试下列操作:


打开 http://127.0.0.1 主页,寻找指向所需信息的链接。

单击刷新按钮,或者以后重试。


HTTP 500 - 内部服务器错误

Internet 信息服务


技术信息(支持个人)


详细信息:

Microsoft 支持


或者是:

Server Application Error

The server has encountered an error while loading an application during the processing of your request. Please refer to the event log for more detail information. Please contact the server administrator for assistance.


(二)安全日志记录(2条)

事件类型: 失败审核

事件来源: Security

事件种类: 登录/注销

事件 ID: 529

日期: 2001-9-9

事件: 11:17:07

用户: NT AUTHORITY\SYSTEM

计算机: MYSERVER

描述:

登录失败:

原因: 用户名未知或密码错误

用户名: IWAM_MYSERVER

域: MYDOM

登录类型: 4

登录过程: Advapi

身份验证程序包: MICROSOFT_AUTHENTICATION_PACKAGE_V1_0

工作站名: MYSERVER


事件类型: 失败审核

事件来源: Security

事件种类: 帐户登录

事件 ID: 681

日期: 2001-9-9

事件: 11:17:07

用户: NT AUTHORITY\SYSTEM

计算机: MYSERVER

描述:

登录到帐户: IWAM_MYSERVER

登录的用户: MICROSOFT_AUTHENTICATION_PACKAGE_V1_0

从工作站: MYSERVER

未成功。错误代码是: 3221225578


(三)系统日志中的记录(2条)

事件类型: 错误

事件来源: DCOM

事件种类: 无

事件 ID: 10004

日期: 2001-9-9

事件: 11:20:26

用户: N/A

计算机: MYSERVER

描述:

DCOM 遇到错误“无法更新密码。提供给新密码的值包含密码中不允许的值。 ”并且无法登录到 .\IWAM_MYSERVER 上以运行服务器:

{3D14228D-FBE1-11D0-995D-00C04FD919C1}


事件类型: 警告

事件来源: W3SVC

事件种类: 无

事件 ID: 36

日期: 2001-9-9

事件: 11:20:26

用户: N/A

计算机: MYSERVER

描述:

服务器未能转入应用程序 '/LM/W3SVC/4/Root'。错误是 'RunAs 的格式必须是<域名>\<用户名>或只是<用户名>'。

若要获取关于此消息的更多的信息,请访问 Microsoft 联机支持站点: http://www.microsoft.com/contentredirect.asp 。

二.原因分析

综合分析上面的错误表现我们可以看出,主要是由于IWAM账号(在我的计算机即是IWAM_MYSERVER账号)的密码错误造成了HTTP 500内部错误。


在详细分析HTTP500内部错误产生的原因之前,先对IWAM账号进行一下简要的介绍:IWAM账号是安装IIS5时系统自动建立的一个内置账号,主要用于启动进程之外的应用程序的Internet信息服务。IWAM账号的名字会根据每台计算机NETBIOS名字的不同而有所不同,通用的格式是IWAM_MACHINE,即由“IWAM”前缀、连接线“_”加上计算机的NETBIOS名字组成。我的计算机的NETBIOS名字是MYSERVER,因此我的计算机上IWAM账号的名字就是IWAM_MYSERVER,这一点与IIS匿名账号ISUR_MACHINE的命名方式非常相似。


IWAM账号建立后被Active Directory、IIS metabase数据库和COM+应用程序三方共同使用,账号密码被三方分别保存,并由操作系统负责这三方保存的IWAM密码的同步工作。按常理说,由操作系统负责的工作我们大可放心,不必担心出错,但不知是BUG还是其它什么原因,系统的对IWAM账号的密码同步工作有时会失败,使三方IWAM账号所用密码不统一。当IIS或COM+应用程序使用错误IWAM的密码登录系统,启动IIS Out-Of-Process Pooled Applications时,系统会因密码错误而拒绝这一请求,导致IIS Out-Of-Process Pooled Applications启动失败,也就是我们在ID10004错误事件中看到的“不能运行服务器{3D14228D-FBE1-11D0-995D-00C04FD919C1} ”(这里{3D14228D-FBE1-11D0-995D-00C04FD919C1} 是IIS Out-Of-Process Pooled Applications的KEY),不能转入IIS5应用程序,HTTP 500内部错误就这样产生了。

三.解决办法


知道了导致HTTP 500内部错误的原因,解决起来就比较简单了,那就是人工同步IWAM账号在Active Directory、IIS metabase数据库和COM+应用程序中的密码。

具体操作分三步,均需要以管理员身份登录计算机以提供足够的操作权限(IWAM账号以IWAM_MYSERVER为例)。


(一)更改Active Directory中IWAM_MYSERVER账号的密码

因IWAM账号的密码由系统控制,随机产生,我们并不知道是什么,为完成下面两步的密码同步工作,我们必须将IWAM账号的密码设置为一个我们知道的值。

1、选择“开始”->“程序”->“管理工具”->"Active Directory用户和计算机",启动“Active Directory用户和计算机”管理单元。

2、单击“user”,选中右面的“IWAM_MYSERVER”,右击选择“重设密码(T)...”,在跳出的重设密码对方框中给IWAM_MYSERVER设置新的密码,这儿我们设置成“Aboutnt2001”(没有引号的),确定,等待密码修改成功。


(二)同步IIS metabase中IWAM_MYSERVER账号的密码

可能因为这项改动太敏感和重要,微软并没有为我们修改IIS metabase中IWAM_MYSERVER账号密码提供一个显式的用户接口,只随IIS5提供了一个管理脚本adsutil.vbs,这个脚本位于C:\inetpub\adminscripts子目录下(位置可能会因你安装IIS5时设置的不同而有所变动)。

adsutil.vbs脚本功能强大,参数非常多且用法复杂,这里只提供使用这个脚本修改IWAM_MYSERVER账号密码的方法:

adsutil SET w3svc/WAMUserPass Password

"Password"参数就是要设置的IWAM账号的新的密码。因此我们将IIS metabase中IWAM_MYSERVER账号的密码修改为“Aboutnt2001”的命令就是:

c:\Inetpub\AdminScripts>adsutil SET w3svc/WAMUserPass "Aboutnt2001"

修改成功后,系统会有如下提示:

WAMUserPass: (String) "Aboutnt2001"


(三)同步COM+应用程序所用的IWAM_MYSERVER的密码

同步COM+应用程序所用的IWAM_MYSERVER的密码,我们有两种方式可以选择:一种是使用组件服务MMC管理单元,另一种是使用IWAM账号同步脚本synciwam.vbs。


1、使用组件服务MMC管理单元

(1)启动组件服务管理单元:选择“开始”->“运行”->“MMC”,启动管理控制台,打开“添加/删除管理单元”对话框,将“组件服务”管理单元添加上。

(2)找到“组件服务”->“计算机”->“我的电脑”->“COM+应用程序”->“Out-Of-Process Pooled Applications”,右击“Out-Of-Process Pooled Applications”->“属性”。

(3)切换到“Out-Of-Process Pooled Applications”属性对话框的“标志”选项卡。“此应用程序在下列账户下运行”选择中“此用户”会被选中,用户名是“IWAM_MYSERVER”。这些都是缺省的,不必改动。在下面的“密码”和“确认密码”文本框内输入正确的密码“Aboutnt2001”,确定退出。

(4)系统如果提示“应用程序被一个以上的外部产品创建。你确定要被这些产品支持吗?”时确定即可。

(5)如果我们在IIS中将其它一些Web的“应用程序保护”设置为“高(独立的)”,那么这个WEB所使用的COM+应用程序的IWAM账号密码也需要同步。重复(1)-(4)步,同步其它相应Out of process application的IWAM账号密码。


2、使用IWAM账号同步脚本synciwam.vbs

实际上微软已经发现IWAM账号在密码同步方面存在问题,因此在IIS5的管理脚本中单独为IWAM账号密码同步编写了一个脚本synciwam.vbs,这个脚本位于C:\inetpub\adminscripts子目录下(位置可能会因你安装IIS5时设置的不同而有所变动)。

synciwam.vbs脚本用法比较简单:

cscript synciwam.vbs [-v|-h]

“-v”参数表示详细显示脚本执行的整个过程(建议使用),“-h”参数用于显示简单的帮助信息。


我们要同步IWAM_MYSERVER账号在COM+应用程序中的密码,只需要执行“cscript synciwam.vbs -v”即可,如下:

cscript c:\inetpub\adminscripts\synciwam.vbs -v

Microsoft (R) Windows Script Host Version 5.6

版权所有(C) Microsoft Corporation 1996-2000。保留所有权利。


WamUserName:IWAM_MYSERVER

WamUserPass:Aboutnt2001

IIS Applications Defined:

Name, AppIsolated, Package ID

w3svc, 0, {3D14228C-FBE1-11d0-995D-00C04FD919C1}

Root, 2,

IISHelp, 2,

IISAdmin, 2,

IISSamples, 2,

MSADC, 2,

ROOT, 2,

IISAdmin, 2,

IISHelp, 2,

Root, 2,

Root, 2,


Out of process applications defined:

Count: 1

{3D14228D-FBE1-11d0-995D-00C04FD919C1}


Updating Applications:

Name: IIS Out-Of-Process Pooled Applications Key: {3D14228D-FBE1-11D0-995D-00C04FD919C1}


从上面脚本的执行情况可以看出,使用synciwam.vbs脚本要比使用组件服务的方法更全面和快捷。它首先从IIS的metabase数据库找到IWAM账号"IWAM_MYSERVER"并取出对应的密码“Aboutnt2001”,然后查找所有已定义的IIS Applications和Out of process applications,并逐一同步每一个Out of process applications应用程序的IWAM账号密码。

使用synciwam.vbs脚本时,要注意一个问题,那就是在你运行synciwam.vbs之前,必须保证IIS metabase数据库与Active Directory中的
cndaijin 2003-04-03
  • 打赏
  • 举报
回复
这些方法我都试过了,可是还是不行呀!!!!!!
saucerman 2003-04-03
  • 打赏
  • 举报
回复
任何ASP都行
而任何ASP .net都不行!
saucerman 2003-04-03
  • 打赏
  • 举报
回复
楼上的这种做法我都试过 N x N 次了,请不要再贴了好不好,你在任何地方都能找到这个关于“HTTP 500”错误的所谓解决方案(在google上查一下就知道了),我不是说它没道理,而其实它只对ASP的出错才有效,而对ASP .net没什么大的意义。

我现在就是执行ASP完全没问题,而执行任何ASP .net都不行,都会出错!
saucerman 2003-04-02
  • 打赏
  • 举报
回复
唉,不论我怎么调IIS或其他相应设置都不行,还是只有ASP和PHP可以执行,而ASP .NET页面一运行就报错。
就总是下面这样的出错提示——

HTTP 500 - 内部服务器错误

或者调IE的选项设置(去掉“显示友好 HTTP 错误信息”)显示错误——

Server Application Error
The server has encountered an error while loading an application during the processing of your request. Please refer to the event log for more detail information. Please contact the server administrator for assistance.



在IE每次执行一次转到或刷新ASP .Net页面时,都会在系统事件日志里产生一条相应的警告信息如下:

事件查看器(本地)

系统
---------------------------------------------------------------

来源:W3SVC

类型:警告

事件 ID:36

描述:
服务器无法加载应用程序 '/LM/W3SVC'。错误是 '找不到指定的元数据'。

---------------------------------------------------------------




真不知该怎么办好了!
saucerman 2003-04-02
  • 打赏
  • 举报
回复
另外,我也重新注册了DLL:

regsvr32 C:\Windows\Microsoft.NET\Framework\v1.0.3705\aspnet_isapi.dll

还是不行啊!
saucerman 2003-04-02
  • 打赏
  • 举报
回复
我原来本是IIS可以运行ASP/ASP .net/PHP的,这些都行,搞不清为什么现在就ASP .net运行不了了。

我也试过用记事本打开下面的这个文件:
C:\WINDOWS\Microsoft.NET\Framework\v1.0.3705\CONFIG\machine.config

然后在其中查找“processModel Attributes:”字符串。
找到后,从此向下找到这样的设置:
userName="[user]" - Windows user to run the process as.
将它改为:
userName="System" - Windows user to run the process as.
再向下找到这样的设置:
password="[AutoGenerate | password]" - Password of windows user. For special users (SYSTEM and machine), specify "AutoGenerate".
将它改为:
password="AutoGenerate" - Password of windows user. For special users (SYSTEM and machine), specify "AutoGenerate".


这也不行!

这些高手们的意见都不行的,另外我也不是域用户,安装系统时就没设成域用户。

求高手帮助!
secondlf 2003-03-25
  • 打赏
  • 举报
回复
你点击页面最上面“回复 | 推荐 | 收藏 | 专题 | 公告 | 管理 | 保存 | 关闭窗口 ”
中的管理,输入密码,把分给了下面的帖子就行了。
各个帖子的分值加起来要等与总分。
liubin314616 2003-03-24
  • 打赏
  • 举报
回复
高手 风,还请教你一个问题,在哪里帮你加分啊,没有找到那个按钮,我是菜鸟
secondlf 2003-03-24
  • 打赏
  • 举报
回复
其实最简单的方法就是把winnt/Microsoft.NET/Framework/v1.0.3705/CONFIG下的machine.config文件,中的<!--processModel Attributes:。。。。。。
userName="[user]"改成userName="system"
password=""改成password="AutoGenerate"
即可
zwp315 2003-03-24
  • 打赏
  • 举报
回复
帮你up一下
secondlf 2003-03-24
  • 打赏
  • 举报
回复
http://support.microsoft.com/default.aspx?scid=KB;en-us;q315158
binapex 2003-03-24
  • 打赏
  • 举报
回复
看看你的IE版本
liubin314616 2003-03-24
  • 打赏
  • 举报
回复
高手 风,您说的很有可能,我在安装完.NET后,又配置了服务器,建了个域,请问您有中文文档没有,我的英语水平实在不感恭维。
secondlf 2003-03-24
  • 打赏
  • 举报
回复
你是不是同时在机子上装了active directery和.net
微软的活动目录和.net存在帐号不一致的问题。
FIX: ASP.NET Does Not Work with the Default ASPNET Account on a Domain Controller
The information in this article applies to:
Microsoft ASP.NET (included with the .NET Framework) 1.0
Microsoft Internet Information Services 5.0
Microsoft Mobile Internet Toolkit (MMIT)

This article was previously published under Q315158
SYMPTOMS
After you install Microsoft Visual Studio .NET or the Microsoft .NET Framework on a domain controller or on a backup domain controller, if you try to run an ASP.NET application, the browser displays the following error message:

Server Application Unavailable

The web application you are attempting to access on this web server is currently unavailable.

Please hit the "Refresh" button in your web browser to retry your request.
Furthermore, the following event is logged in the system application event log:

aspnet_wp.exe could not be launched because the username and/or password supplied in the processModel section of the config file are invalid.
aspnet_wp.exe could not be started.
HRESULT for the failure: 80004005
This applies to Internet Information Services (IIS) version 5.0 or later.
CAUSE
By default, ASP.NET runs its worker process (Aspnet_wp.exe) with a weak account (the local machine account, which is named ASPNET) to provide a more secure environment. On a domain controller or on a backup domain controller, all user accounts are domain accounts and are not local machine accounts. Therefore, Aspnet_wp.exe fails to start because it cannot find a local account named "localmachinename\ASPNET". To provide a valid user account on the domain controller, you must specify an explicit account in the <processModel> section of the Machine.config file, or you must use the SYSTEM account.

NOTE: If you try to debug (click the Start button) before you try to browse to the page you can experience the exact same problem.
RESOLUTION
To work around this problem, use one of the following methods:
Create a weak account that has the correct permissions, and then configure the <processModel> section of the Machine.config file to use that account.
Set the userName attribute to SYSTEM in the <processModel> section of the Machine.config file.
Configure the <processModel> section of the Machine.config file to use an administrator account.
NOTE: Allowing ASP.NET applications to run as SYSTEM or an administrator account has serious security implications. If you use either of these workarounds, code that is run in the Aspnet_wp.exe process will have access to the domain controller and the domain settings. Executable files that are started from the Aspnet_wp.exe process run in the same context and also have access to the domain controller.

Therefore, Microsoft recommends that you use the first workaround. To use the first workaround, follow these steps:
Create a user account on the computer named ASPUSER, and then add this account to the Users group.

NOTE: You can also use the ASPNET account that the .NET Framework created if you change the password on this account. You must know the password on this account because you add the password to the <processModel> section later in these steps.
Grant the ASPUSER or the ASPNET account the Log on as a batch job user right. Make sure that this change appears in the Local Security Policy settings.

NOTE: To grant the Log on as a batch job user right on this account, you may have to grant this user right in each of the following security policies (From the Control Panel/Administrative Tools):


Domain Controller Security Policy
Domain Security Policy
Local Security Policy

NOTE: You may have to reboot the server for these changes to take effect.
Make sure that the ASPUSER or the ASPNET account has permission to access all of the necessary directories and files to start the Aspnet_wp.exe process and to serve the ASP.NET pages.For additional information about what permissions you must grant to this account, click the article number below to view the article in the Microsoft Knowledge Base:
317012 INFO: Process and Request Identity in ASP.NET

Open the Machine.config file. The path to the file is: %Systemroot%\Microsoft.NET\Framework\v1.0.3705\CONFIG.
In the <processModel> section of the Machine.config file, change the userName and the password attributes to the name and the password of the account that you created in step 1. For example:
userName="DomainName\ASPUSER" password="ASPUSERpassword"
Save the changes to the Machine.config file.
STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article. This bug was corrected in ASP.NET (included with the .NET Framework) 1.1.
REFERENCES
For additional information about ASP.NET security, click the article number below to view the article in the Microsoft Knowledge Base:
306590 INFO: ASP.NET Security Overview

liubin314616 2003-03-24
  • 打赏
  • 举报
回复
那个我已经试过了,不行啊。
贝贝壳壳 2003-03-24
  • 打赏
  • 举报
回复
检查一下你的aspx没有问题。
试试
在visual studio 命令行下运行
aspnet_regiis -i

62,074

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧