Link to home
Start Free TrialLog in
Avatar of Turnstyle78
Turnstyle78

asked on

ActiveX component can't create object: 'Scripting.FileSystemObject'

I am having difficulty with invoking the Scripting.FileSystemObject ActiveX Component via ASP. I am using IIS 5.1 on a Windows XP Professional system. I keep recieving "Error Type: Microsoft VBScript runtime (0x800A01AD) ActiveX component can't create object: 'Scripting.FileSystemObject'" when calling a simple script I have used many times before. The code is as follows:

Const LOGFilePath= "H:\NOTES.txt"
str = "Yeah, Whatever"
Set fsox = CreateObject("Scripting.FileSystemObject")
Set stream = fsox.OpenTextFile(LOGFilePath, 8, True)
stream.WriteLine str

After doing some research, I downloaded and installed the latest Windows Script 5.6 for Windows 2000 and XP. This has now caused all ASP to fail on my test system. I now receive "The page cannot be displayed" errors across the board, where as before the ASP pages would render and just not invoke FileSystemObject. I have also uninstalled and then reinstalled IIS. Any help concerning this matter is greatly appreciated.
Avatar of SquareHead
SquareHead

As far as the file sysytem object, check for script blocking in any antivirus program you may be running...
Avatar of Turnstyle78

ASKER

I was using a trial of the latest version of Norton Antivirus. During my trial I had script blocking disabled. I also just recently uninstalled the Norton trial so I don’t think it is a script blocking issue.

I appreciate the insight though
Avatar of Anthony Perkins
Since I assume this code is running server-side, change this:

Set fsox = CreateObject("Scripting.FileSystemObject")

To:
Set fsox = Server.CreateObject("Scripting.FileSystemObject")
@acperkins--

The difference between CreateObject and Server.CreateObject is T-SQL.

Turnstyle...

Did you install the right one?

http://msdn.microsoft.com/library/default.asp?url=/downloads/list/webdev.asp

You can also try to reregister vbscript/jscript.

regsvr32.exe vbscript.dll
regsvr32.exe jscript.dll
I ran the code server side and nothing happened,

i then ran it client code and it worked,

this is down to my IE security settings , resetted them to default level and got
ActiveX cannot create FileScriptingObject error.

The best suggestion I can help you (if you runngin it client side ) is to

Set these settings  in your IE security tab (for extra security add your server to the Intranet tab and mess with these )

Active X Controls and Plug Ins
Automatic prompting for Active X Controls                            Enable
Binary and script Behaviours                        Enable
Download signed Active X Controls                           Prompt/Enable
Download unsigned ActiveX Controls                           Prompt/Enable
Initialise and script ActiveX controls not marked as safe      Prompt/Enable
Run Active X controls and plugins                            Prompt/Enable
Script Active X Controls marked safe for scripting               Prompt/Enable

Most of these are set to Enable or Prompt anyway but its the

Initialise and script ActiveX controls not marked as safe      Prompt/Enable
Run Active X controls and plugins                            Prompt/Enable

that will probally make your script work

For the Prompt and enable I have them all set to enable as I hate having to click muchos buttones .


--------------------
On a seperate note has anyone ever got the
ActiveX cannot create error from the server? , maybe Ive been lucky but neve rseen it
or
my servers set up to do it?
The only time I've seen the error was when it was the wrong version, blocked, corrupted or not properly registered or didn't exist.

Neither CreateObject or Server.CreateObject work. I don't believe it to be a code issue.
I am really leaning towards something is out to lunch with the engine. As I mentioned above, I have gone to Microsoft and downloaded the latest Windows Script 5.6 for Windows 2000 and XP. The problem is when I install this updated engine, all ASP ceases to render. Without the updated engine, ASP will render with the exception of the FileSystemObject. For instance, Server.CreateObject("ADODB.Connection") works fine. (without the updated engine)

I have tried regsvr32.exe of everything I could think of to no avail. I also just recently re-loaded my workstation so I do not believe it is a malicious virus or something of the sort. I am puzzled. I will have to wait until lunch to try a few of your suggestions.
 
 I appreciate all the help.....
kiddanger,

>>The difference between CreateObject and Server.CreateObject is T-SQL.<<
LOL
acperkins...

always love your professionalism...

I made a typo.  Meant to put transaction server, MTS not T-SQL.
>>always love your professionalism...<<
I am sorry, I could only assume it was a joke.

>>Meant to put transaction server, MTS not T-SQL.<<
Sorry, was that another typo?  What has MTS got to do with using Server.CreateObject?

In any case, we are getting off topic here.  It is unrelated to the question at hand.
Turnstyle78,

So where do we stand with this question?  Have you managed to resolve this question?  If not, have you checked the Application Event log on the server to see if there are any errors?
The problem remians the same. I have tried all the suggestions to no avail. I have not viewed the Application Event Log. I will do so after work. Any idea why installing the latest Windows Script 5.6 for Windows 2000 and XP would casue ASP to stop rendering?
@acperkins--

No offense but you can look these up just as easily as I can.
http://www.4guysfromrolla.com/webtech/043099-1.shtml

Turnstyle...

Verify you have the correct version for your OS and install it again.  You may have to disable system restore.  Then manually make sure the files are registered.

If that doesn't work and you're not sure if something is blocking it, then you may want to use SysInternals filemon.
kiddanger,

Let me quote your link in its entirety so that everyone can read it, without having to go to the link:

<quote>
Server.CreateObject invokes Microsoft Transaction Server (MTS) to create the object and handle it, whereas CreateObject goes straight to it.

While I have found no articles written on these two, the conclusion comes from the fact that if you have an erroneous object, CreateObject gives you an error, but when you do Server.CreateObject, it gives you an error and logs an error in the event log, viewable via Event Viewer.

This can become significant if you are writing a component that deals with transactions, as it would be a good safety net to pass it through MTS, because you will be using MTS commands. However, if you are not using MTS, you could create processor and memory over head by passing it through Server.CreateObject. This makes it a better idea to use CreateObject, because it goes straight through.

I hope you understand the difference now, and when to use the two.

God Bless from Ryan S

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

This article was written by Ryan S. Ryan has been a computer programmer in the loosest sense since the age of 8. He has been working with ASP since the age of 13, when it first came out (that he knows of), and is somewhat advanced at it.

</quote>

Now that we have got that behind us, let's get back to the problem and resolve it.
Turnstyle...

If you're now getting the page cannot be displayed, do you get that with all pages, including .html pages?
No, only ASP pages fail. Everything else works fine. All ASP pages fail to render with an updated Scripting Engine. As far as the Scripting Engine goes, I am quite sure I downloaded the proper OS version from Microsoft.

Thanks,
TurnStyle78
Ok, well then let's try to exclude the dlls if we can.

Can you use FSO from a VBS file?
Have you registered the dlls manually?
Have you now checked the event log?

Have you tried converting your FileSystemObject code to a vbs and executing on the server?  This at least will help trouble shoot the problem.
And make sure you change to Server.CreateObject in your ASP pages before you re-test to check the Event log.
Here are the list of dll's that ScrRun.dll uses:

ADVAPI32.DLL
GDI32.DLL
KERNEL32.DLL
MFC42.DLL
MSVCRT.DLL
NTDLL.DLL
OLE32.DLL
OLEAUT32.DLL
RPCRT4.DLL
USER32.DLL
VERSION.DLL

Most, if not all. of these are Kernel Dll's, so you should not ahve any problems with those.  I have just included them for completeness.
I can successfully invoke the FileSystemObject from a VBS file. That was a good idea for a test, thank you. As for the event log, it contains no helpful information concerning this issue. I was sure to invoke the Server.CreatObject method prior to searching the log. So now it appears that the FileSystemObject is operational but not from ASP???
>>So now it appears that the FileSystemObject is operational but not from ASP???<<
That would imply, at least in my view a permissions problem when executing as an anonymous user.  For one, you should verify that there are in fact no antivirus applications currently running.
I am certain there are no antivirus applications running. I did recently remove Norton Antivirus Internet Security 2005 from my system about three days ago. While it was installed Script Blocking was turned off.
Is your test only with drive H?  Is that a logical drive on the web server or is it a map to another system?
No, I have tested other drives as well. All my tests now are currently on the C drive
And all your tests are?  and are all the results 404 errors? (page not found)
Ok, let's start tracking the process, if you're willing to try that.

Start here:
http://www.sysinternals.com/Utilities/AccessEnum.html
Download AccessEnum so you know exactly what the effective rights are.

http://www.sysinternals.com/Utilities/Filemon.html
Download FileMon and we'll filter out what we don't want to see and concentrate on what is happening at the file system level when trying to use FSO from ASP.

We'll start there before we start considering rogue elements being involved.
Ok, I will give that a try and let you know how it went
Here are a few tests to try:

1.) Try the following script to see if you can get any more error information:

<%
Sub WriteFile
      On Error Resume Next
      Dim fso 'As FileSystemObject
      Dim ts 'As TextStream
      Set fso = Server.CreateObject("Scripting.FileSystemObject")
      NewFileName = Server.MapPath("./Files/new.txt")

      If Not fso Is Nothing Then
          Set ts = fso.CreateTextFile(NewFileName)
          ts.WriteLine info
          ts.Close
      End If

      If Err.Number <> 0 Then
            Response.Write "ERROR NUMBER: " & Err.Number & "<br>"
            Response.Write "ERROR DESCRIPTION: " & Err.Description & "<br>"
      End If

End Sub


Call WriteFile
%>

2.) Does the following code display 5.6? or does it give you an error?

<%=ScriptEngineMajorVersion & "." & ScriptEngineMinorVersion%>

3.) I believe the same dll that is used for the filesystem is used for the scripting dictionary object, does the following code work?

<%
Set oDictionary= Server.CreateObject("Scripting.Dictionary")
%>
I ran the above code as per your request. The first code snippet resulted in:

  ERROR NUMBER: 424
  ERROR DESCRIPTION: Object required

The second code snippet resulted in:

  Server object error 'ASP 0177 : 800401f3'

  Server.CreateObject Failed

  /mv/tester2.asp, line 5

  Invalid class string

I am going to try FileMon and AccessEnum next

Thanks
http://support.microsoft.com/?kbid=315453

CAUSE
Your ADO components are incorrectly registered

There are other parts of the article that are relevant.
kiddanger,

>>Your ADO components are incorrectly registered<<
I suspect that this may be a typo.  The FileSystemObject is unrelated to ADO (MDAC) and uses a totally different dll, namely SCRRUN.dll
Further, how would that explain that the questioner can use the FileSystemObject with vbs on the same server, but not when they use ASP.
Anthony...

object required

You generally get that when you try to reference an object that's not an object.  More times than not, 'set' is not used.  A simple fix.

We also get an object creation error:
Server object error 'ASP 0177 : 800401f3'

  Server.CreateObject Failed

  /mv/tester2.asp, line 5

It references line 5:

Set fso = Server.CreateObject("Scripting.FileSystemObject")

If this is line 5, while we don't need 'Server', we're obviously trying to create the object.  This would imply the first error reported was a result of this error.  If you can't create an object , you can't reference it as one.

MSFT gave us some help: ASP 0177: 800401f3

That error reports a dll is not properly registered.  That takes us back to square one because that is what was originally thought.  It's either corrupt in some way or it cannot be reached.

So, the dll is just a red herring because the fix could apply to numerous dlls if it's not registered properly or if it's blocked.  It's the task required to fix it which is the same which is why this error applies to more than just one dll.

Is it possible to partially register a dll?  I dunno.  Do you?  Perhaps it's not black and white.  Perhaps there are many different variations of a dll being properly registered.  I do know.  Do you?  If it's not properly registered, why doesn't MSFT tell us that?  I dunno.  Do you?

Here's a thought.  Post your help to the author.  If you know the solution, post it.  If you don't, and you want to participate, then go do some research and post your results.  If you're only going to criticize everything I post on every question at EE, then I'd suggest you look for something else to do with your time.

There may be an underlying cause why the dll will not properly register.  I've seen vbs work when the same dlls would not work when used with ASP and once the dlls were registered manually, the issue was resolved.  I don't know why if a dll is not properly registered it doesn't report it during registration and put in the event log but then I didn't write it and I can only conclude it's because the process is not absolute.

I'm surprised the issue has gone on this long.  It is almost as if there is something we're not being told but that may be because the author doesn't see it either.  We haven't even ventured into rogue elements being in play which may be interfering but I'm sure you will see that as a typo also.

Here's another article referenced in the article I posted:
http://support.microsoft.com/kb/309051/

...which discusses using FileMon which I have already stated might be helpful which the author said he was going to do next.  FileMon can be overwhelming when first used.  That information may be helpful, even if the error is not exact.

Perhaps you'd like to once again post the whole article in the question?  A more productive approach would be to work towards a solution rather than work towards an argument.

However, I will make an effort to end the argument now.  If the author would rather I do not participate any longer on this question, then I will unsubscribe and allow you and the others to continue.
kiddanger,

I trust all is well with you and I cannot tell you how much I am impressed with your vast experience and knowledge.  But I was hoping you may be able to enlighten me here.  So let me try it again:  What has the questioner's prroblem got to do with ADO? Are you saying that the FileSystemObject is unrelated to the FileSystemObject and it is really an ADO problem?

Thank you for your help and your support in this community and I hope you will reconsider your current position and once again provide 100% help to all the members here.  I realize that you have not been here very long, but there are many that count on technical knowledge and acumen.

Anthony
P.S.  Sorry English is not my first language.
And of course that should have been:
but there are many that count on your technical knowledge and acumen.
Anthony...

I have a lot of knowledge as many do here.  I am just as capable of making errors as anyone.  Perhaps I am reading more into your responses than you are intending.

I don't think the issue is FSO or ADO particularly.  I think either the dll is not properly registered or it being blocked from being accessed.  I have no idea what is the cause of either.  I'm not relating ADO to FSO.  I am disassociating them as being specific.

To prove that we could try using other ActiveX components, like ADO, and perhaps we will get the same outcome.  That would point more towards it not having access rather than it being a registration issue but it would not be absolute because it is possible more than one would be corrupt.

However, the VBS access does play some in the picture because it can be used.  Does VBS use it exactly as ASP does?  If so, then we could probably rule out that particular dll being corrupt and focos more on access to it via ASP.

What if we tried using JScript instead of VBScript and see if it has the same issue in ASP?!  My point on the last point you questioned was to prove one way or the other one of the two possibilities.  Proving yourself wrong allows you [anyone] to eliminate possibilities.  I only see errors in two categories, cause and effect.

A cause error to me is something that is the direct cause of the issue.  An effect error is an error that is the result of something else failing, which it is dependent upon.  In this case, a dll or dlls not properly registered would be (a) cause error(s).  A script block would be an effect error.  A reference to an object failing is a result error if the object is not created first.

The only thing that appears to be in our favor is this is all happening on the same system which would eliminate any networking, naming, commuincation issues and other types of blocks like firewalls, IPSec, etc.

A JScript test:

<%@ Language = "JScript" %>
<%
  var fso = new ActiveXObject("Scripting.FileSystemObject")
%>

If it's fails in VBScript here, then this should fail also if it's being blocked.
All,
      To help ease confusion and see this process along I am going to re - post the initial issue and symptoms along with tests done and results concluded.
      The root of the problem is I cannot invoke Scripting.FileSystemObject from ASP. I receive ActiveX component can't create object: 'Scripting.FileSystemObject'". I can however invoke the Scripting.FileSystemObject from VBS. Further testing has shown that Server.CreateObject("Scripting.Dictionary") also fails to work from ASP.
      I have registered all the .dlls that could be corrupted manually. I have verified that my MDAC is correct. I have attempted to install the latest scripting engine from Microsoft for Windows 2000 and XP. When I do this all ASP pages fail with "Page cannot be displayed". This to me is most troubling as I see no reason why updating my Scripting Engine would cause this. Without updating my Engine, I can do general things in my ASP code such as create database connections. I have thoroughly investigated the script blocking option and have no reason that I am aware of to suspect that script blocking is running. I was running Norton. However, script blocking was disabled the entire time Norton was in use and I have since un-installed Norton. I reloaded my computer very recently and believe to be running clean without any viruses or the like.
     I intend on running FileMon and AccessEnum as suggested as soon as I can. This issue is on my home development machine so my testing is limited during the work day. I will also run the suggested JScript test.
    Now that we are all caught up are there any suggestions on why an updated scripting engine would stop ASP from working.

Thank you all for your contributions
I am afraid I am out of ideas.
ASKER CERTIFIED SOLUTION
Avatar of peterxlane
peterxlane

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
>>@acperkins & kiddanger:  Can't we all just get along???<<
Huh?
I was sensing a lot of tension between acperkins & kiddanger, that's all...
>>I was sensing a lot of tension between acperkins & kiddanger, that's all...<<
Perhaps you did not read the whole thread:  We kissed and made up.
He used his tongue too. yuck!
Turnstyle...

There is definitely an issue when you cannot upgrade your scripting engine.

While this is not the same dll, it is the same issue and some recommendations of what to look for and how test for failure or blocking.  It also explains a little better of what the error actually means.

http://www.15seconds.com/faq/Errors/522.htm


I'm having the exact same problem TurnStyle!  Did you get it working?  I also have a recently reloaded home development machine.  It's driving me mad!
No, I have not resolved the issue. I am on the verge of reloading my machine again. It is very puzzling. Please let me know if you uncover anything.

Thank You
TurnStyle78
Just out of curiosity Bob3975, are you have the same problem with updating your Scripting Engine.
No, I noticed after I posted my message that you reloaded the scripting Engine.  I also did that but it had no effect good or bad.  I just posted a question at https://www.experts-exchange.com/questions/21564927/Automation-server-can't-create-object.html that you may want to monitor.
Have you been checking my post?  Looks like you should unshare your application directory then reshare it similar to the link http://forums.aspfree.com/archive/t-31394 that Fritz_the_blank put up.
Someone had a similar thread here:

https://www.experts-exchange.com/questions/21564927/Automation-server-can't-create-object.html

I am posting just in case you find it helpful.

FtB
No comment has been added to this question in more than 21 days, so it is now classified as abandoned..
I will leave the following recommendation for this question in the Cleanup topic area:
PAQ - Refund

Any objections should be posted here in the next 4 days. After that time, the question will be closed.

thefritterfatboy
EE Cleanup Volunteer
Changed recommendation: Delete - No refund

thefritterfatboy
EE Cleanup Volunteer
I was never able to resolve the issue with recommendations from the thread. I ended up just reloading my machine. More to the point, a large portion of this thread was a useless argument between other posters, so a refund would be great.
If the reload of the OS solved the issue, then I vote for a refund.  You could delete the irrelevant portions of the document but the possible resolutions should be kept and paq'd.
>>I was never able to resolve the issue with recommendations from the thread. I ended up just reloading my machine. More to the point, a large portion of this thread was a useless argument between other posters, so a refund would be great.<<

Peterxlane suggested the OS reload. If that worked you should award the points to him. Due to the original asker abandoning the thread and not posting a request in community support for a refund, I doubt the cleanup mods will grant a refund.

The final decision is not mine, I merely make a recomendation and the cleanup mods will read the responses made since that.
I abandoned the thread because it wasn't going anywhere. The squabbling didn't help. Also, telling someone to reload their machine and start over is not a helpful solution. That is merely saying, "Sorry Kid, your screwed"
>>Also, telling someone to reload their machine and start over is not a helpful solution. <<
I beg to differ with you.  It was the solution, you confirmed it.  I agree with thefritterfatboy

>>That is merely saying, "Sorry Kid, your screwed"<<
That is not the case here, but that is also covered here:

The correct answer to some questions is "you can't do that"
https://www.experts-exchange.com/Web/Web_Languages/ASP/help.jsp#hi54
Statement:
Reloading your OS to solve a single issue is giving up.  It means you're a girlieman.  You had a fight with the computer and lost.  Don't ever believe reloading the OS is a solution for anything.  You're in denial.  The computer only does what it is told.

Opinion:
He admitted he gave up.  He was man enough to admit it and he didn't do it as a solution to the problem.  The computer won.  He deserved to have his points refunded.

To suggest it as an alternative solution is a girleman suggestion.  To reward such nonsense means you're a Liberal girlieman.  If you disagree with me, you're a girlieman.  That's all I know.  (O;=
>>Don't ever believe reloading the OS is a solution for anything.<<

You've obviously never dealt with some of the messed up servers I've seen!

In this case, there probably was another solution, but to me it seems fair that if a suggestion made was the solution you finally opted for then the points should be awarded.

</my two cents>
fritter...

Thanks for responding and I appreciate you providing your explanation.

I've seen some really skeery server and desktop/laptop installation in 26 years.  I've seen more than 550 infections on a single system (that implies 550+ different infections), not instances.  I do believe after an infection an OS should be reloaded but not as a fix to eliminate the infection.  It should be done as a safeguard that nothing has been missed since antivirus agents only stop/repair/remove what they know, unless it's a boot record virus which is hard to do without a FAT-16 partition.

I disagree to reward points for a suggestion to give up.  Obviously if the author cannot find the cause, he is going to eventually give up.  Unless he can replace the system while he continues to investigate, he will choose the path of least resistance because time is money.  A replacement system is usually only available to very large networks and only if they feel it is warranted, meaning more than one system having the issue.

You learn nothing by giving up and may fall into two possible negative scenarios:

1. You learn nothing and may repeat the mistake.
2. After reloading the OS, you will be putting back on patches/updates and 3rd party software.  See #1.  It may be an exercise in futility and you will still not have an answer.  What then?  Reload?  *raises eyebrow*

Let us also not forget data must be backed up before reloading.
In my case the following commands fixed this issue:

regsvr32.exe vbscript.dll
regsvr32.exe jscript.dll
regsvr32.exe ScrRun.dll
In my case the following commands fixed this issue:

regsvr32.exe vbscript.dll
regsvr32.exe jscript.dll
regsvr32.exe ScrRun.dll