Server.CreateObject Failed in Classic ASP

我们两清 提交于 2019-12-30 11:15:14

问题


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


回答1:


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!




回答2:


Did you register your dll with regasm.exe on your server ?

http://msdn.microsoft.com/en-us/library/tzat5yw6%28VS.71%29.aspx




回答3:


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



回答4:


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)




回答5:


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.




回答6:


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



回答7:


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();

    }



回答8:


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.



来源:https://stackoverflow.com/questions/8269076/server-createobject-failed-in-classic-asp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!