Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Server.CreateObject( ) failure with 32 bit Windows and IIS 7

Windows 7 32 bit, IIS 7.5.760016385

I created a DLL in Visual Basic 6.0 and trying to use it from within classic ASP code:

set obj = Server.CreateObject("a.b")

I get the following error:

006 ASP 0178
Server.CreateObject Access Error
The call to Server.CreateObject failed while checking permissions. Access is denied to this object.
err.number = -2147024891

I have tried creating the iusr_cmpname user and giving rights to it in the Default website and virtual directory of this ASP page. I have REGSVR32'd the dll's.

I have gone to "Turn Windows features on and off" and selected IIS/World Wide Web Services/Application Development Features then CHECKED off ASP, ASP.net, ISAPI extensions, and ISAPI filers.

I have followed many leads in different Newsgroups but I can get past this problem. We tried this last year, a year and 1/2 ago and had the same problem. Since we couldn't conquer this problem, we went back to Windows NT. We never had this problem on NT.

Now we are trying again to get past this so we can move to Windows 7 again. It seems that many people had this problem but any solution they found and have posted, don't seem to be what I need.

Any help will be appreciated. Thank you.

like image 874
user1894838 Avatar asked Dec 11 '12 14:12

user1894838


2 Answers

I strongly recommend using Procmon to find the access violation. I had a similar issue years ago, and this was the only thing that solved it. In that scenario, it turned out to be a lack of permissions on the system temp folder.

If you post the results from Procmon, I may be able to amend this answer to be more helpful.

like image 50
David Pfeffer Avatar answered Nov 11 '22 02:11

David Pfeffer


The problem seems to be related to IIS not being able to access YOUR custom VB6 Active X dll on the file system. I registered a custom dll, that I created, in the same directory as the default web application and was able to get ASP to create the object.

Here's what I did:

  • Clean install of Windows 7 Professional 64 bit, SP1.

  • Enable the Windows ASP feature

  • This step ONLY for 64-bit Windows - Using IIS Manager, enable 32 bit applications for the default application pool.

enable 32-bit application pool

  • Create a simple VB6 Active X dll (class name is "CXUtils.Utils") that adds two input numbers, and returns the result.

Utils.cls:

Public Function Sum(ByVal a As Integer, ByVal b As Integer) As Integer     
    Sum = a + b
End Function
  • This is the important step - in an administrative command prompt, register the Vb6 Active X dll in the default Web application location: C:\inetpub\wwwroot

Register Custom VB6 DLL

  • Create and install a simple asp page that instantiates the dll from above. The install location is the default web application location C:\inetpub\wwwroot

Default.asp:

<%@ Language=VBScript %>
<%
Option Explicit
Response.Expires = 0
Response.Expiresabsolute = Now() - 1 
Response.AddHeader "pragma","no-cache" 
Response.AddHeader "cache-control","private" 
Response.CacheControl = "no-cache" 

Function Sum(a, b)
    Sum = a + b
End Function

Function Sum2(a, b)
    Dim adder
    set adder = Server.CreateObject("CXUtils.Utils")
    Sum2 = adder.Sum(a, b)
    set adder = nothing
End Function
%>
<html>
    <head>
        <title>Add</title>
    </head>
    <body>
    <b>2 + 3</b> = <%= Sum(2,3) %><br />
    <b>3 + 4</b> = <%= Sum2(3,4) %>
    </body>
</html>
  • Browse to the web app and see the results

Sample asp page results

My apologies if this doesn't all compile - there was a lot of editing to get the formatting to appear correctly.

like image 4
chue x Avatar answered Nov 11 '22 03:11

chue x