Classic ASP : C0000005 Error on execution
Asked Answered
D

12

10

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

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

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'

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

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

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

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?

Donela answered 10/1, 2011 at 17:17 Comment(7)
What Object are you Creating?Wartow
What is the object you are trying to create?Amiss
It's a custom object. Retrieves some stuff from db. I have the dll registered. No source code tho.Donela
Try writing a small .vbs file that create the object, just to rule out problems in the component itself. Maybe the components depends on some outside file, ODBC registry, etc.Chapel
This links may help 15seconds.com/faq/Errors/476.htm and 15seconds.com/faq/Errors/362.htmChapel
@Edurado I created a asp file with just Set myObject = Server.CreateObject("CDO.Message") and it works just fine.Donela
Are you using AVG Free?Underworld
S
2

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.

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

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

Sheffield answered 11/1, 2011 at 21:2 Comment(4)
if you are going to try this from VBS, be sure to use the vbscript.exe that matches the 'bitness' of the ASP ISAPI dll.Roderich
This is really interesting. I created a online vbs file with just to create object. When I executed from my own directory I got this error "(null): 0x800700C1" When I copied the dll and the vbs file to c:\windows\syswow64\ and executed the file .. I get this error "Microsoft console bases script host has stopped working" From EventVwr "Problem signature: P1: cscript.exe P2: 5.8.7600.16385 P3: 4a5bc670 P4: StackHash_0a9e P5: 0.0.0.0 P6: 00000000 P7: 02ca0068 P8: c0000005 P9: 00000008 P10: "Donela
@Broken Link: Unless you specifically use the [c|w]script.exe in the syswow64 folder the you would have been running the 64 bit version but your dll will be 32bit. The C1 error (which is ERROR_BAD_EXE_FORMAT) is likely complaining about that. When you run the 32bit version of cscript you see the same error you are getting in ASP. This confirms that your dll is broke and needs fixing.Sheffield
I'm running from syswow64(C:\Windows\SysWOW64>cscript.exe test.vbs) and I get the error "Microsoft console bases script host has stopped working" - Looks like the dll is broke..Donela
D
3

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.

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.

Dockyard answered 9/8, 2014 at 12:13 Comment(0)
S
2

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.

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

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

Sheffield answered 11/1, 2011 at 21:2 Comment(4)
if you are going to try this from VBS, be sure to use the vbscript.exe that matches the 'bitness' of the ASP ISAPI dll.Roderich
This is really interesting. I created a online vbs file with just to create object. When I executed from my own directory I got this error "(null): 0x800700C1" When I copied the dll and the vbs file to c:\windows\syswow64\ and executed the file .. I get this error "Microsoft console bases script host has stopped working" From EventVwr "Problem signature: P1: cscript.exe P2: 5.8.7600.16385 P3: 4a5bc670 P4: StackHash_0a9e P5: 0.0.0.0 P6: 00000000 P7: 02ca0068 P8: c0000005 P9: 00000008 P10: "Donela
@Broken Link: Unless you specifically use the [c|w]script.exe in the syswow64 folder the you would have been running the 64 bit version but your dll will be 32bit. The C1 error (which is ERROR_BAD_EXE_FORMAT) is likely complaining about that. When you run the 32bit version of cscript you see the same error you are getting in ASP. This confirms that your dll is broke and needs fixing.Sheffield
I'm running from syswow64(C:\Windows\SysWOW64>cscript.exe test.vbs) and I get the error "Microsoft console bases script host has stopped working" - Looks like the dll is broke..Donela
H
2

I had exactly the same error.

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

ProcessMonitor help me finding it. (Filter by process, and check "Name not found") Name not found on 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.)

Hiles answered 17/9, 2013 at 15:22 Comment(1)
Did you mean filter by Result?Burch
A
2

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

<%
...
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, or you can cast the field to a non-max varchar:

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

Very important: If you make this fix and the error still happens, recycle the app pool to make the error go away.

(For what it's worth, I had this problem happen after KB4093114 was 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.)

Alvira answered 23/4, 2018 at 20:6 Comment(1)
I had a similar Win update problem. I ended up having to upgrade my database and us different drivers. Now all is good again, no recoding required. It is as if the old driver was mall functioning.Quintet
Y
1

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.

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

Yulan answered 25/10, 2016 at 14:56 Comment(0)
D
1

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.

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

Drip answered 5/8, 2019 at 18:43 Comment(0)
U
0

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

Underworld answered 13/3, 2016 at 17:40 Comment(0)
A
0

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.

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 :)

Auvil answered 6/4, 2016 at 9:52 Comment(0)
S
0

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:

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

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

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 answers on this page
  5. Messing about with Application Pools
  6. Messing about with lots of versions of Microsoft Visual C++ Redistributables

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

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:

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.

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.

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

Struggle answered 5/12, 2019 at 20:54 Comment(1)
I'm very curious about this. We just deployed a new cluster (Windows 10) and started seeing the same error. I wonder if what you're alluding might be a change in the way ASP or its dependencies on Windows 10 now tolerates "lazy coding" (i.e. falsies, null, etc.).Underwent
Q
0

Did you just do a Windows update? I did, abouts 2021-11-20 to 21H2 19044.1387. Somehow the update along with other updates made my code constantly crash. I found that I could code around some errors, but the database (MariaDB 10.1) returned values that did not match up. I found I could declare my sql calls differently to get the right returns -- but quickly stopped re-coding. Somehow NULL was handled differently.

I was getting suspect that the driver to the database was not working the same way it used to be. I changed all connections from Server.CreateObject to CreateObject. And ended up updating the database (I am now on MariaDB 10.6) and I am using new dedicated MySQL 8.0 Unicode 64-bit driver. I am connecting via DSN.

UPDATE: These (C0000005) errors kept appearing when using Server.CreateObject. With just CreateObject it is now finally starting to look promising.

Quintet answered 25/11, 2021 at 15:48 Comment(0)
Q
0

I was using this code to get the image height and width on every page and it is WIA that somehow had a memory leak and would randomly crash IIS application pool:

    SET objFSO= CreateObject("Scripting.FileSystemObject")
    If objFSO.fileExists(is_blog_img) and InStr(is_blog_img,".webp") = 0  Then
        dim oIMG
        SET oIMG = CreateObject("WIA.ImageFile") '<< do not use this!
        oIMG.loadFile(is_blog_img)
        og_image_h = "" & oIMG.Height
        og_image_w = "" & oIMG.Width
        SET oIMG = nothing
        if og_image_h & "" <> "" then
            %>
            <meta property="og:image:width" content="<%=og_image_w %>" />
            <meta property="og:image:height" content="<%=og_image_h %>" />
            <%
        end if
    else
        response.write("<!-- no file is_blog_img -->")
        og_image_w = "0"
        og_image_h = "0"
    end if
    SET objFSO = Nothing 
Quintet answered 26/2, 2022 at 16:1 Comment(0)
R
-2

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

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.

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.

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.

good luck, Mark

Roderich answered 11/1, 2011 at 21:21 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.