Server.CreateObject Failed with chiliupload component - asp-classic

I get the following error with a legacy asp application that I have been asked to help out with.
Server object error 'ASP 0177 : 800401f3'
Server.CreateObject Failed
/site_manager/image_upload.asp, line 27
800401f3
The line ofcode that throws the error is shown below:
Set fbase = Server.CreateObject("chili.upload.1")
As you ahve probably guessed oldschool asp isn't my strong point but from the research I have done it seems as if a component hasn't been registered on the server (I only have FTP access).
What component needs to be regsistered?
Thanks for the help...

You're missing the registration of the DLL that creates the chili.upload.1 object. Are you trying to run this on a Linux machine?

You need to register the Sun Chili!Soft ASP components. Here's the manual on this from 2003:
http://ns7.webmasters.com/caspdoc/html/running_the_setup_program_sun_chili_soft_asp_for_windows.htm. Note that this only works if you still have the original setup. Otherwise you're out of luck. Sun Chili!Soft ASP is no longer available and very, very dead.
If you're just interested in file upload functionality on ASP, I can recommend Free ASP Upload. It requires no registration of any components and generally works. I can also recommend this article on the topic of ASP uploads. If you're willing to shell out some money there are hundreds of components that do the same thing too.

Register the DLL on your computer, and then do this:
Locate and then click the following registry subkey:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\MAIN\
FeatureControl\FEATURE_IGNORE_ZONES_INITIALIZATION_FAILURE_KB945701
Note If the FEATURE_IGNORE_ZONES_INITIALIZATION_FAILURE_KB945701 subkey does not exist, you must manually create it. If you're using a 64 bit OS, you may need to use HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\MAIN\ FeatureControl\FEATURE_IGNORE_ZONES_INITIALIZATION_FAILURE_KB945701 instead
Right-click FEATURE_IGNORE_ZONES_INITIALIZATION_FAILURE_KB945701,
point to New, and then click DWORD Value
Type w3wp.exe to name the new registry entry, and then press ENTER.
Right-click w3wp.exe, and then click Modify.
In the Value data box, type 1, and then click OK.
After setting this registry key, a simple app pool restart will apply the change. No longer will your .NET COM components randomly stop working with no real solution except shuffling application pools!

Related

Locating the source DLL behind a COM+ ProgId

I've never really had to debug Classic ASP, so this is a little rough and most likely a poor question, but I have done as much research as I could before asking.
I have a request to identify what code prints to a printer, and re-use that code in a new page that someone has built.
While trying to identify that, I've stumbled on a few things that I don't understand, but namely one big one.
The gist is, people can order cookies from the cafeteria, and when they submit, it shows a confirmation page and that order is sent to a printer.
To get a list of cookie options, there's a Server Object created, and from there a method exists, but I cannot identify where it is or where I should be looking. Here's the code:
<%
On error resume next
Const CATAGORY_COOKIE = 1
Dim cookieNames
Dim objCookie
Dim Count
Set objCookie = Server.CreateObject("CookieOrder.CookieRequest")
if objCookie Is Nothing then
Response.Write "Error"
Response.End
End if
cookieNames = objCookie.getAvailable_Item_Names(CATAGORY_COOKIE)
Count = objCookie.Count
Dim sz
sz = Split(cookieNames, ";")
Set objCookie = Nothing
%>
How do I identify what the Server Object is? There's a .dll file that contains binary, but I'm not familiar with how that could be utilized.
I have tried to follow the browser dev tools, but they really haven't been too helpful in this aspect.
I am hoping that learning how this code is executing or where it's being executed I will figure out my other problems.
Bit of background
The project is using a COM+ component. These are defined in Classic ASP using the syntax;
Set obj = Server.CreateObject("[insert COM+ ProgId]")
In this project you are using a component registered with the ProgId
CookieOrder.CookieRequest
There are many out of the box COM+ components available to Classic ASP that provide a lot of common functionality such as;
Visual Basic Scripting Runtime
ActiveX Data Objects
There is also the ability to create COM+ components for use with Classic ASP using languages common to the time like Visual Basic, Visual C++ and more recently using the .NET Framework (C#, VB.NET).
How to locate COM+ libraries
NOTE: Please be careful when accessing the registry as modifying or deleting keys could lead to a corrupt operating system.
Also for the purposes of this guide will use the Scripting.Dictionary ProgId.
The key is using the ProgId to find an elusive COM+ library.
Start %SystemRoot%\system32\regedit.exe (will work in most Windows Operating Systems)
Navigate to the HKEY_CLASS_ROOT hive and select it, then press Ctrl + F to open the Find dialog box.
In Find what type the ProgId in this case Scripting.Dictionary and make sure in look at only Key is checked then press Find or Find Next.
If a ProgId key is found expand to the key and locate the CLSID key which contains a (Default) REG_SZ with the value of the CLSID in the case of this example {EE09B103-97E0-11CF-978F-00A02463E06F}. Double click this value to bring up the Edit String dialog copy the value into your clipboard.
Return to the HKEY_CLASS_ROOT key and use Find to search for the CLSID value which in this example is {EE09B103-97E0-11CF-978F-00A02463E06F} and again make sure Look at has only Key checked then press Find or Find Next.
If the key is found expand and locate the InprocServer32 key in it you will find the location of DLL in the (Default) REG_SZ value. In this example that is C:\Windows\System32\scrrun.dll (this will be different depending on installation location and OS)
What about decompiling?
There's a lot of assumption in the comments about the compiler used to compile the DLL (mainly .NET), but the best way to check is to use one of the many programs out there in the public domain designed for this purpose.
There is a specific question on SO that deals with this;
Answer by #simon-mᶜkenzie to Identifying the origin of a DLL

What is causing intermittent "Object reference not set to an instance of an object" at compile time in VS 2010?

I am sorry if this is not really a coding question (it depends on if its my code causing the problem I suppose).
I have seen this question: Tracking down intermittent 'Object reference not set to an instance of an object.' error on build
However, it has not been of much help (although if you read the comments, you will see that I thought it did help for a while there).
When I try publish my website, occasionally, I will get an error with no file or line reference:
Pre-compiling Web Site
Building directory '/App_Code/'.
Building directory '/'.: Publication (web): Object reference not set to an instance of an object.
Pre-compilation Complete
------ Skipped Publish: Project X:\, Configuration: Debug Any CPU ------
I know the usual causes of "Object reference not set to an instance of an object" but this seems a bit different, isn't it supposed to be a runtime error? Not a build error?
What is weird is that it happens, seemingly at random (about 25%-33% of the time). I can try to publish it and have it fail. Then try again straight after, without changing anything and it works fine.
I started getting this error after moving some of my functions (VB.net btw) to a new file in the App_Code folder so they can be accessed by all pages of the site.
If you need any more info, please let me know.
Thanks,
EDIT: After further investigation, it seems to only happen if I try to publish the website within a few seconds of saving changes to any file within it. What could cause this?
The same error occurred for me to, I deleted the dlls of the custom controls in the web site that are already in the bin, then i published the web site, and succeeded
IF you have any custom/usercontrols in your project, they are actually running at design time and can give object ref errors. This can occur during builds too. In that case, a property is being referenced that is NOTHING and throws the error.
I had a similar problem with a Windows Form project.
Wherever I try to move a custom control on the windows form, and then try to save the form, VS2010 comes back with "Object not set to an instance of an object".
I suspected the error was deep down in the layers of abstraction in my inherited code, but couldn't work out how deep to go, without reviewing every line of code.
My solution to this problem is this.
Open up another instance of Visual Studio 2010
Menu: Debug | Attach to Process..
Search for "devenv.exe xxx YourApplicationName..." and select it
Click "Attach"
Menu: Debug | Exceptions..
Tick all the boxes in the thrown column, then "OK"
Your second instance of VS2010 is not debugging your first instance, including all the custom controls.
Return to the first instance of VS2010, and repeat the actions that caused the error in the first place, the second instance of VS2010 will break at the line of code that has the error.
You may want to look at this link there is a bug in vs2012
https://connect.microsoft.com/VisualStudio/feedback/details/749901/error-when-i-click-publish-object-reference-not-set-to-an-instance-of-an-object

Server.CreateObject Failed in Classic ASP

I created the ASP.NET dll with one function that i need to use in Classic ASP page.
I used the below code for creating object in classic asp page
set PeopleSoft = server.createobject("OPS.PSL")
I am getting the below error while executing
Server object error 'ASP 0177 : 80070002'
Server.CreateObject Failed
I searched in stackoverflow i saw some solution. By enabling the "Make assembly COM-visible" and "Register for COM interop".
Please Help me to come out from this issue
You have to register your DLL first, and if the problem persists, do this:
Locate and then click the following registry subkey:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\MAIN\
FeatureControl\FEATURE_IGNORE_ZONES_INITIALIZATION_FAILURE_KB945701
Note If the FEATURE_IGNORE_ZONES_INITIALIZATION_FAILURE_KB945701 subkey does not exist, you must manually create it. If you're using a 64 bit OS, you may need to use HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\MAIN\ FeatureControl\FEATURE_IGNORE_ZONES_INITIALIZATION_FAILURE_KB945701 instead
Right-click FEATURE_IGNORE_ZONES_INITIALIZATION_FAILURE_KB945701,
point to New, and then click DWORD Value
Type w3wp.exe to name the new registry entry, and then press ENTER.
Right-click w3wp.exe, and then click Modify.
In the Value data box, type 1, and then click OK.
After setting this registry key, a simple app pool restart will apply the change. No longer will your .NET COM components randomly stop working with no real solution except shuffling application pools!
Did you register your dll with regasm.exe on your server ?
http://msdn.microsoft.com/en-us/library/tzat5yw6%28VS.71%29.aspx
I had this problem. When you register .NET COM modules you must use regasm and if you want to call them from applications like IIS you must use /codebase with this command:
regasm yourfilename.dll /codebase
I just had this error appear on a site that had been running perfectly for years. It seems a DLL had somehow become unregistered. It was an unmanaged DLL so I was able to re-register it using regsvr32:
%SystemRoot%\Microsoft.NET\Framework\v2.0.50727\regsvr32 "C:\path\to\myAssembly.dll"
(Also see the difference between regasm and regsvr32)
On this website :
http://connect.microsoft.com/VisualStudio/feedback/details/294241/kb937143-breaks-asp-to-net-com-interop
They fix the problem with giving read access to IUSR on HKEY_USERS\S-1-5-20\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones.
Run this from the command prompt (replace myassembly.dll with your assembly path):
%SystemRoot%\Microsoft.NET\Framework\v2.0.50727\regasm.exe myassembly.dll /codebase
I faced a similar issue and after much research i found the solution ,check if its working for you.
Remote scripting causes tons of errors with different IE versions. If your are passing control from one page to another and creating a new object from there you will get this kind of unable to create object error.
Example:
page x.asp--
function1call()
function2call()
further in page x.asp--
function1call(){
var rs_obj = RSGetASPObject("some-object");
----some other things---
frmPost.action = "someplace.asp";
frmPost.submit();
}
function2call(){
var rs_obj = RSGetASPObject("some-object1"); //you wont be able to create
//this object
----some other things---
}
It seems like the remoteScripting object is not getting initiated . As function1call() calls frmPost.submit().
If you combine these 2 functions it will start to work. I.E
page x.asp--
function1call(){
var rs_obj = RSGetASPObject("some-object");
var rs_obj = RSGetASPObject("some-object1");
----some other things---
frmPost.action = "someplace.asp";
frmPost.submit();
}
There is another reason you might get the error "Server.CreateObject Failed". A COM Visible DLL does not behave the same as a regular .NET DLL when it is being loaded by COM. You can't expect it to load other DLLs that are sitting in the same directory as your DLL, or downloaded through the Nuget package manager. If you want to load other DLLs you have to register them in the global assembly cache (GAC).
see: https://stackoverflow.com/a/23902131/2616170
If the assembly doesn't have a strong name then you won't be able to register it in the GAC.

COM Exception - TYPE_E_CANTLOADLIBRARY?

I am using a COM dll in my .Net web application. This works fine on multiple different machines.
However on one particular machine I get the following error:
Unable to cast COM object of type 'CServer.CApplicationClass' to interface type 'CServer.ICApplication'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{CF0DFA28-046B-4C7D-8AA9-F4B7477D8CAE} ' failed due to the following error: Error loading type library/DLL. (Exception from HRESULT: 0x80029C4A (TYPE_E_CANTLOADLIBRARY)).
I have registerd the dll using the regsvr32 command.
I have also created a COM+ application for this dll.
Running a search through the registry
I can find the key in numerous places.
I have also tried unregistering the dll and deleting all referneces on the computer to this dll. And afterwards re-adding the dll and re-registering it.
I have written a simple windows script file which tests the dll. This works fine. However the problem exists in my .net project which is running in iis.
Can anyone help me with this?..
If you need anymore info please leave a comment. Thanks.
I had a similar problem, with the "TYPE_E_CANTLOADLIBRARY" message.
Background:
I had a project which used Interop.ReferenceA.dll. This file was created using tlbimp ReferenceA.dll /out: Interop.ReferenceA.dll.
Solution:
When I took a look at ReferenceA.dll using RegDllView I noticed that ReferenceA.dll had a subclass, which was the IID shown in the error message.
I looked around in the source code of the subclass and noticed that it had a dependency to Interop.ReferenceB.dll.
Turns out that the subclass needed Interop.ReferenceB as a type-library to work. So I ran this:
regasm /tlb:Interop.ReferenceB.tlb Interop.ReferenceB.dll (the 32-bit version of regasm was used.)
And the error went away.
Make sure your AppPool is set to x86. Also make sure your assembly is targeting only x86.
I was having a similar issue. First got Access Denied, which after some looking around was resolved, only to be faced with this error message (TYPE_E_CANTLOADLIBRARY). Mind that I'm running a COM+ Component on Windows 7.
After some fruitless attempts which involved messing with the registry, my workmate and I found a way of getting it up and running:
1) Unregister your dll (regsvr32 -u dllname)
2) make sure your references to the dll are cleared up from registry (backup first)
3) Create an empty com+ application (server app) in Component Services
4) Copy the application id to the clipboard
5) go to "c:\program files (x86)\Complus applications" and create a folder with the id on your clipboard
6) copy your dll into that folder and register it
7) Go back to your Component Services and add the component to the app you created using the dll on "c:\program files (x86)\Complus applications{*app id*}"
that did it for me. Hope it helps.
I had a similar problem where the error was triggered on my PC but not on that of other developers.
It turns out that I had been testing an automatic build process on my PC that had updated the version number of the assembly, thus registering the TLB in the registry with a version number higher than the one we were normally using.
When trying to get the interface, the server was consistently using the wrong TLB information leading to the wrong assembly. Once I deleted the higher version entry in the registry, it worked fine.
Now we just have to ensure the build process is not going to cause that issue again. :)

GetObjectContext returns nothing in VB6 COM dll, called from classic ASP

I am debugging this Active X dll using the VB6 IDE. I can see the execution get as far as an attempt to GetObjectContext. This method always returns NOTHING.
This is happening on Windows 7 32 bit, IIS 7. (The application is working in other locations, one of which is Windows Server 2008 with IIS 7)
I have Googled extensively and found many references to this relating to COM+, but there is NO COM+ involved in my scenario. Just plain old Server.CreateObject from a registered dll.
I have ASP code as follows
SET objCalendar = Server.CreateObject("SSYSDEV.Calendar")
objCalendar.BuildCalendar("ADMINUSERS")
SET objCalendar = Nothing
The problem lines of the requested function in the dll are:
Dim objHttpRequest As ASPTypeLibrary.Request
Set objHttpRequest = GetObjectContext.Item("Request")
Any help or suggestions, as always, will be greatly appreciated.
I'm still getting over the shock of having to work with VB6 - I never thought it would happen! It's like being dragged back to the dark ages, in a very rough fashion that's causing blisters!
P.S. I have also set up a COM+ component and had the ASP get the object that way, GetObjectContext returns an empty object in this case, which has no ASP objects in it. So this is no help :-(
I know this is a little late, but I had a similar problem and this solved it for me:
Thread: Problem accessing Request object via COM+
http://forums.iis.net/t/1146404.aspx
Summary: turn on 'Allow IIS Intrinsic Properties' in the COM+ component.
I've found that the COM+ approach to using VB6 components in IIS to be a bit flaky. I add this to a VB6 class that I want to instance in ASP::-
Private moScriptCtx As ScriptingContext
Public Sub OnStartPage(SC As ScriptingContext)
Set moScriptCtx = SC
End Sub
You can now access Request,Response,Server etc as properties of the moScriptCtx object.
You might be wondering how you call OnStartPage in the first place. You don't ASP automagically does that for you during the CreateObject execution.

Resources