11

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.

Shadow The Vaccinated Wizard
  • 62,584
  • 26
  • 129
  • 194
user1894838
  • 111
  • 1
  • 1
  • 4
  • What is the error message you are receiving from IIS? – Treborbob Dec 11 '12 at 15:09
  • Err.description is "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 – user1894838 Dec 11 '12 at 16:16
  • have you tried to make the apppool user/the iusr an local administrator? just for testing... or use another windows user for the appool and the web application wait... have you tried to add a web application instead of a virtual directory? – ulluoink Dec 12 '12 at 09:59
  • Thanks for your suggestions. Giving Administrator rights to iusr_xxx and "Network Service" didn't help. I don't know how to set another user for the Application Pool, I don't see a security tab from the Application pool in the IIS Administrator. I have tried, as you suggested to change the virtual directory to an application but then the page doesn't open at all; it just hangs. So I have changed it back to a Virtual Directory. Thanks for your thoughts. – user1894838 Dec 12 '12 at 15:46
  • In IIS7 the iusr is invisible, but you can still add rights. In the requester where you select a User or Group just type: IIS APPPOOL\{application pool name} and click 'check names'. Not a solution for your problem, but it might get you closer to a solution... – Erik Oosterwaal Dec 19 '12 at 11:43
  • have you tried another vb6 dll? is this specific for the dll you mention or does this apply to every vb6 dll? are asp pages without server.createobject running? – ulluoink Dec 19 '12 at 14:39
  • ulluoink, I have not tried any other VB6.dll only the one on this system: C:\Windows\System32\ msvbvm60.dll of date 7/13/2009. On this file, I added run and execute rights for "Everyone", "iusr_comp_name", "Network Service" – user1894838 Dec 20 '12 at 15:47
  • Thank you Rico. I still can't seem to find where to add rights – user1894838 Dec 20 '12 at 15:53
  • Have you tried putting the DLL in the same folder as the .asp file as also suggested in [this answer](http://stackoverflow.com/a/14035020/447356)? – Shadow The Vaccinated Wizard Dec 26 '12 at 07:41
  • I found that making the IIS user (or whatever use runs the app trying to use the DLL) has read/execute permission on the DLL on the filesystem fixed the problem. In my case, in the developer environment, I just gave read/execute permissions to the user account called "Users" and that solved the same problem for me. – Developer Webs Jan 11 '19 at 21:38

5 Answers5

4

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.

David Pfeffer
  • 36,331
  • 28
  • 120
  • 198
  • Hi David, I added the Process Monitor. When I try to run this ASP page, PRL.asp, it says the Process Name is w3wp.exe ...Operation is QueryAllInformationFile ...Path: d:\xxx\PRL.asp ...Result: Overflow Buffer ... ... the next line say: Process Name is w3wp.exe ...Operation is QueryOpen ...path: d:\xxx\prl.asp\web.config ...Result: Path not found. --------------thank you. Any ideas? – user1894838 Dec 20 '12 at 15:39
  • That sounds like you just don't have a web.config file -- are there other errors? – David Pfeffer Dec 20 '12 at 15:53
  • this is an old ASP app, we have a GLOBAL.asa and no web.config is necessary. Other errors:RegQueryValue and RegQueryKey say Name Not found. Some entries say Buffer Too Small or Buffer Overflow. – user1894838 Dec 20 '12 at 16:07
  • web.config is an IIS thing as well as a .NET thing, so IIS will still look for it. – David Pfeffer Dec 20 '12 at 17:04
  • The only ACCESS DENIED record is for Process Name: w3wp.exe, OPERATION: RegOpenKey, Path: HKCR\CLSID\{6205F916-F7E2-4A11-8E78-526BF4EE20CA} This relates to the COM Object that Server.createObject is trying to create. If I search in the Registry, this entry give read and execute permissions for iusr_comp_name, iwam_comp_name, "Network service". Should I add another user? – user1894838 Dec 20 '12 at 19:37
  • 1
    That is odd. I would check two things. (1) In procmon, you should see the access rights requested on the same line as the RegOpenKey. See if it's requesting unusual rights. (2) If not, then check you security settings. Does the app use impersonation level security? If so, then the user of the app needs access to that key too. You can add the necessary rights for "Everyone". Note that there will probably be additional keys under TypeLib and Interface that you'll have to change. (It will likely require multiple sessions with procmon to find everything.) – Peter Ruderman Dec 20 '12 at 19:49
  • 1) no "Desired Access: Read". 2) I'll check Security settings soon for Impersonation. 3) I just now added priviledges in the registry for this COM object for Everyone and for IIS_IUSRS. I see no affect so far. I have "iisreset"d but haven't rebooted if that would change things. I have to leave for the day now. Thanks for your help. – user1894838 Dec 20 '12 at 19:58
  • Now that you've added the privileges, is that error gone from procmon? – David Pfeffer Dec 21 '12 at 15:20
  • Yes, I can find no ACCESS DENIED errors now. But it still doesn't work. In fact the CreateObject error is the same: "err.description "006~ASP 0178~Server.CreateObject Access Error~The call to Server.CreateObject failed while checking permissions. Access is denied to this object." – user1894838 Dec 21 '12 at 18:46
  • Sorry, I've got no other ideas. :-( – David Pfeffer Dec 25 '12 at 20:44
4

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.

chue x
  • 17,865
  • 6
  • 52
  • 67
  • Thanks Chue, On my old XP machine, this worked fine without even registering the COM object in the Component Manager or with REGSVR32. but on the new Windows 7 machine, it fails on the createObject line. I will try registering it in either or both ways. Maybe something so simple will lead to better understanding of this problem. – user1894838 Dec 28 '12 at 14:15
  • Hey Chue, I simply registered with regsvr32 and it worked. I will try unregistering and then using the Component Manager. Then both. Thanks for your help. I will try increasing the complexity of this simple COM object until it is like the one that fails always. That should let me understand better. Thanks for your help. --- Doug – user1894838 Dec 28 '12 at 14:29
0

This page suggests that the problem may be the access rights assigned to the VB runtime. Try assigning everyone read and execute permissions on Msvbvm60.dll.

http://support.microsoft.com/kb/278013

Peter Ruderman
  • 11,737
  • 32
  • 56
  • Thank you Peter, I tried that earlier. I added run and execute rights for "Everyone", "iusr_comp_name", "Network Service" – user1894838 Dec 20 '12 at 16:20
0

I think I was having a similar problem. I was trying to interactivey debug code in a VB6 DLL that was running in the VB6 IDE from a classic ASP application. When the application executed the Server.CreateObject statement it returned the following error:

Server object: 006~ASP 0178~Server.CreateObject Access Error~The call to Server.CreateObject failed while checking permissions. Access is denied to this object.

BTW, I am running IIS 7.5 in a Windows 7 environment. I finally found a Microsoft article that said the problem was due to a missing registry entry for VB ASP Debugging in DCOM and/or inadequate permissions with DCOM, not IIS. The URL for the article is http://support.microsoft.com/kb/q259725. I implemented Work Around #1. One re-boot later, I could step into the VB DLL code from ASP. Chalk one up for Microsoft, and I don’t say that very often :-)

JCBishop
  • 21
  • 2
0

Another approach that might work, is to install the DLL as DCOM application on dcomcnfg. It will run under different credentials.

Negarrak
  • 355
  • 1
  • 3
  • 11