windows 经典 ASP:C0000005 执行错误

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4649487/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 07:56:55  来源:igfitidea点击:

Classic ASP : C0000005 Error on execution

windowsasp-classicwindows-server-2008-r2

提问by Broken Link

I'm trying to execute classic ASP pages on a windows 2008 64 bit R2 box.

我正在尝试在 Windows 2008 64 位 R2 机器上执行经典的 ASP 页面。

Initially the problem was with registering dlls : That's now fixed. Register DLL file on Windows Server 2008 R2

最初的问题在于注册 dll:现在已修复。 在 Windows Server 2008 R2 上注册 DLL 文件

Now when I try to access the page I get this error

现在,当我尝试访问该页面时,出现此错误

Active Server Pages error 'ASP 0241'

CreateObject Exception

index.asp

The CreateObject of '(null)' caused exception C0000005.

Server object error 'ASP 0177 : c0000005'

Active Server Pages 错误“ASP 0241”

创建对象异常

索引.asp

'(null)' 的 CreateObject 导致异常 C0000005。

服务器对象错误“ASP 0177:c0000005”

When I change the code from Server.CreateObject to CreateObject .. I end up with this error

当我将代码从 Server.CreateObject 更改为 CreateObject .. 我最终遇到了这个错误

Active Server Pages error 'ASP 0115' Unexpected error index.asp

A trappable error (C0000005) occurred in an external object. The script cannot continue running.

Active Server Pages 错误“ASP 0115”意外错误 index.asp

外部对象中发生可捕获错误 (C0000005)。脚本无法继续运行。

I checked everything I could - Access and admin rights etc. The application pool are set to No Managed Code + Classic mode.

我检查了所有我能做的 - 访问和管理员权限等。应用程序池设置为无托管代码 + 经典模式。

Any ideas to fix this?

任何想法来解决这个问题?

采纳答案by AnthonyWJones

You're not going to fix this in ASP. The C0000005 is the Access Violation Exception. This occurs when code attempts to read memory that it hasn't allocated.

你不会在 ASP 中解决这个问题。C0000005 是访问冲突异常。当代码尝试读取尚未分配的内存时会发生这种情况。

The dll is doing something bad when it loads or during the construction of the object.

dll 在加载时或在构建对象期间做了一些不好的事情。

Have you tested the dll with a simple .vbs file?

您是否使用简单的 .vbs 文件测试了 dll?

回答by Guish

I had exactly the same error.

我有完全相同的错误。

In my case the C0000005 error was caused by a missing dependancy.

在我的情况下,C0000005 错误是由缺少依赖引起的。

ProcessMonitor help me finding it. (Filter by process, and check "Name not found") Name not found on dll

ProcessMonitor 帮我找到它。(按进程过滤,并选中“未找到名称”) 在 dll 上找不到名称

Copying the needed file in the right place solved my problem. (In my case VB6FR.dll was a needed dependancy for vb6 in french.)

在正确的位置复制所需的文件解决了我的问题。(在我的情况下,VB6FR.dll 是法语中 vb6 的必需依赖项。)

回答by Arboc

I spent several hours chasing this down as well.

我也花了几个小时来解决这个问题。

In my case, it was caused by reusing a recordset object several times without closing it between DB calls. The code was working without apparent issue in several similar instances, and then one of them just stopped tolerating the process.

就我而言,这是由于多次重用记录集对象而没有在 DB 调用之间关闭它造成的。该代码在几个类似的情况下都没有出现明显问题,然后其中一个就停止了容忍该过程。

The error occurred when I attempted to close the recordset at the end of the page, which made troubleshooting more difficult.

当我尝试关闭页面末尾的记录集时发生错误,这使得故障排除更加困难。

I cleaned up the code, ensuring the recordset was closed between calls, and this resolved the issue.

我清理了代码,确保记录集在调用之间关闭,这解决了问题。

回答by user7070321

I had same error while loading the csv file data more than once. Step 1 - Firstly create a temp table to transfer the csv data into temp table and then move to main table and delete temp table once data is moved. This has to be done programmatically.

我不止一次加载 csv 文件数据时遇到同样的错误。步骤 1 - 首先创建一个临时表,将 csv 数据传输到临时表中,然后移动到主表并在移动数据后删除临时表。这必须以编程方式完成。

Step 2 - Go to mysql and select the database and use this query ( SHOW FULL PROCESSLIST; ) use without brakets. this will show you status of running objects.If you find any object with status as "Sleep" this needs to be cleared before 2nd attempt to upload the file. usually the default wait time is about 28000 sec. You need to reduce it as per requirement. Code to reduce the wait time is ( SET GLOBAL wait_timeout=5; ). Use without brakets. Use this is mysql. this will re-set your global wait time to 5 sec, (change as per your needs). This should resolve your problem. All the best.

第 2 步 - 转到 mysql 并选择数据库并使用此查询 (SHOW FULL PROCESSLIST;) 使用不带刹车。这将显示正在运行的对象的状态。如果您发现任何状态为“睡眠”的对象,则需要在第二次尝试上传文件之前将其清除。通常默认等待时间约为 28000 秒。您需要根据要求减少它。减少等待时间的代码是( SET GLOBAL wait_timeout=5; )。不带刹车使用。使用这个是mysql。这会将您的全局等待时间重新设置为 5 秒(根据您的需要进行更改)。这应该可以解决您的问题。祝一切顺利。

回答by Keith

I had the same problem happen sometime after KB4093114was installed on a server. (I'm not 100% sure that the KB caused the problem but I suspect so because the scripting engine was updated.)

在服务器上安装KB4093114后,我遇到了同样的问题。(我不是 100% 确定 KB 导致了问题,但我怀疑是因为脚本引擎已更新。)

The problem was caused by a recordset that output a varchar(max) field to the markup. Even though the error does not provide a line number, I was able to pinpoint it to the outputting of the varchar(max) field through trial and error.

该问题是由将 varchar(max) 字段输出到标记的记录集引起的。即使错误没有提供行号,我也能够通过反复试验将其定位到 varchar(max) 字段的输出。

<%
...
rs.Open "SELECT LongDescription FROM Table1"
while (not rs.EOF)
   %> <p><%= rs("LongDescription") %></p> <%    ' ERROR HAPPENS BECAUSE OF THIS LINE
   rs.MoveNext
wend
%>

Removing that line fixes the problem. Also, casting the field to a non-max varchar also fixes it:

删除该行可以解决问题。此外,将字段转换为非最大 varchar 也会修复它:

 rs.Open "SELECT LongDescription = Cast(LongDescription as varchar(4000)) FROM Table1"

To make matters worse, I found that once the error happens, even if you fix it you need to recycle the app pool to make the error go away.

更糟糕的是,我发现一旦错误发生,即使你修复了它,你也需要回收应用程序池以使错误消失

回答by DoWhileNot

I'm running some very old ASP code in IIS on a new Windows 10 1803 installation, and had it briefly running correctly then started to get this error message after running a repair in Office to fix an Outlook issue.

我在新的 Windows 10 1803 安装上的 IIS 中运行了一些非常旧的 ASP 代码,并让它短暂正确运行,然后在 Office 中运行修复以修复 Outlook 问题后开始收到此错误消息。

In this case, reinstalling the Microsoft Access Database Engine fixed the problem.

在这种情况下,重新安装 Microsoft Access 数据库引擎解决了该问题。

回答by 4532066

I'm adding this answer here, though I realise this is very much later than when the question was first answered. I'm putting the answer here in case it saves anyone else the hassle I've just been through.

我在这里添加这个答案,尽管我意识到这比第一次回答问题要晚得多。我把答案放在这里,以防它为其他人省去我刚刚经历的麻烦。

I too was getting this error on my ASP page after I had re-installed Windows 10. Previously on my localhost IIS setup, the same page did not error. However - now it did - with the following error:

重新安装 Windows 10 后,我也在我的 ASP 页面上收到此错误。以前在我的本地主机 IIS 设置中,同一页面没有错误。但是 - 现在它确实 - 出现以下错误:

Active Server Pages error 'ASP 0115' Unexpected error index.asp

A trappable error (C0000005) occurred in an external object. The script cannot continue running.

Active Server Pages 错误“ASP 0115”意外错误 index.asp

外部对象中发生可捕获错误 (C0000005)。脚本无法继续运行。

I tried lots of things to try and sort it, such as:

我尝试了很多东西来尝试对其进行排序,例如:

  1. Reinstalling Windows 10 again
  2. Reinstalling IIS on the new Windows 10 installation
  3. Trying all sorts of combinations of versions of MySQL and the ODBC Connector
  4. Checking for missing files in Windows Process Monitor as per one of the answerson this page
  5. Messing about with Application Pools
  6. Messing about with lots of versions of Microsoft Visual C++ Redistributables
  1. 再次重新安装 Windows 10
  2. 在新的 Windows 10 安装上重新安装 IIS
  3. 尝试各种版本的 MySQL 和 ODBC 连接器的组合
  4. 根据此页面上的答案之一检查 Windows Process Monitor 中的丢失文件
  5. 与应用程序池打交道
  6. 使用许多版本的 Microsoft Visual C++ Redistributables

My problem was with an SQL Insert - when it ran, I got the error.

我的问题是 SQL 插入 - 当它运行时,我收到错误。

This is a cut down version of it:

这是它的精简版:

sql = ""
sql = sql & " INSERT INTO my_table ( "
sql = sql & " card_sender,  "
sql = sql & " senders_email,  "
sql = sql & " recipients_email,  "
sql = sql & " card_body,  "
sql = sql & " session_id, "
sql = sql & " replyID) VALUES ( "
sql = sql & " ?,  "
sql = sql & " ?,  "
sql = sql & " ?,  "
sql = sql & " ?,  "
sql = sql & " ?,  "
sql = sql & " ?)  "

Set stmt = Server.CreateObject("ADODB.Command")
stmt.ActiveConnection = oConn
stmt.Prepared = true
stmt.commandtext = sql

stmt.Parameters.Append stmt.CreateParameter("@001_card_sender", adVarChar, adParamInput, 255, card_sender)
stmt.Parameters.Append stmt.CreateParameter("@002_senders_email", adVarChar, adParamInput, 255, senders_email)
stmt.Parameters.Append stmt.CreateParameter("@003_recipients_email", adVarChar, adParamInput, 255, recipients_email)
stmt.Parameters.Append stmt.CreateParameter("@004_card_body", adLongVarChar, adParamInput, 256665, card_body)
stmt.Parameters.Append stmt.CreateParameter("@sessionsessionID", adVarChar, adParamInput, 255, session.sessionID)
stmt.Parameters.Append stmt.CreateParameter("@replyID", adVarChar, adParamInput, 255, session("replyID"))

stmt.Execute
Set stmt = Nothing

Via a process of building up the SQL and finding which line triggered the error, I found this line caused the problem:

通过构建 SQL 并查找哪一行触发错误的过程,我发现此行导致了问题:

stmt.Parameters.Append stmt.CreateParameter("@replyID", adVarChar, adParamInput, 255, session("replyID"))

In my example, the session("replyID")value was not set, and that triggered the error.

在我的示例中,session("replyID")未设置该值,这触发了错误。

When I changed the code to check if the session variable was set, it fixed the issue:

当我更改代码以检查会话变量是否已设置时,它解决了问题:

...
foo = session("replyID")
if foo = "" then foo = 1
...
stmt0003.Parameters.Append stmt0003.CreateParameter("@replyID", adVarChar, adParamInput, 255, foo)

More testing confirmed that the error would happen for any variable which was null, so I had to add in an if statement for every variable and set it to something if it was null, to prevent these errors which I didn't used to get on a previous Windows 10 installation on the same PC.

更多的测试证实,任何为空的变量都会发生错误,所以我必须为每个变量添加一个 if 语句,如果它为空,则将其设置为某些内容,以防止这些我不习惯出现的错误在同一台 PC 上安装了以前的 Windows 10。

After spending about a day working on it, it was a relief to get to the bottom of it.

在花了大约一天的时间研究它之后,找到它的底部是一种解脱。

回答by Vixed

For my experience, you are using AVG Free, and after an update, you got this kind of error.

根据我的经验,您使用的是 AVG Free,并且在更新后出现此类错误。

回答by Harm

Just ran into this same error while trying to use my own com control and in my case it turned out to be caused by my dll being compiled in debug mode.

在尝试使用我自己的 com 控件时遇到了同样的错误,在我的情况下,它原来是由我的 dll 在调试模式下编译引起的。

There are two ways around that:

有两种方法可以解决这个问题:

  1. Run IIS in debug mode. For 32 bit you use the following line: C:\Windows\SysWOW64\inetsrv>w3wp.exe -debug

    Note that you have to stop the IIS service and for 64 bit you use the one in System32.

  2. Compile a release version :)

  1. 在调试模式下运行 IIS。对于 32 位,您使用以下行:C:\Windows\SysWOW64\inetsrv>w3wp.exe -debug

    请注意,您必须停止 IIS 服务,对于 64 位,您可以使用 System32 中的服务。

  2. 编译发布版本:)

回答by Mark

You might want to check out this blog entry, titled "Classic ASP (ASP 3.0) doesn't work on 64bit with 32bit COM objects" http://blogs.msdn.com/b/robgruen/archive/2005/05/26/422328.aspx

您可能想查看这篇博客文章,标题为“Classic ASP (ASP 3.0) 不适用于 64bit with 32bit COM objects” http://blogs.msdn.com/b/robgruen/archive/2005/05/26 /422328.aspx

it's a bit dated and the author incorrectly refers to the ASP handler as an ISAPI filter (it's an extension, not a filter), but otherwise the information seems good.

它有点过时,作者错误地将 ASP 处理程序称为 ISAPI 过滤器(它是一个扩展,而不是过滤器),但除此之外,信息似乎很好。

if the asp handler is only compiled as 64bit, you will not be able to load a 32bit COM object into it no matter what you do.

如果 asp 处理程序仅编译为 64 位,则无论您做什么,都无法将 32 位 COM 对象加载到其中。

the author does mention something about a COM+ solution. I have a feeling that a 32bit out of process COM+ package would be able to load this 32bit COM object and your ASP page could make cross process calls to this COM+ package.

作者确实提到了一些关于 COM+ 解决方案的内容。我有一种感觉,一个 32 位进程外 COM+ 包将能够加载这个 32 位 COM 对象,并且您的 ASP 页面可以对这个 COM+ 包进行跨进程调用。

good luck, Mark

祝你好运,马克