Server.CreateObject Failed in Classic ASP

前端 未结 8 906
抹茶落季
抹茶落季 2021-01-05 21:34

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         


        
相关标签:
8条回答
  • 2021-01-05 22:11

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

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

    0 讨论(0)
  • 2021-01-05 22:11

    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();
    
        }
    
    0 讨论(0)
  • 2021-01-05 22:11

    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.

    0 讨论(0)
  • 2021-01-05 22:12

    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
    
    0 讨论(0)
  • 2021-01-05 22:18

    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!

    0 讨论(0)
  • 2021-01-05 22:19

    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.

    0 讨论(0)
提交回复
热议问题