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

5

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.

Benevolent answered 11/12, 2012 at 14:55 Comment(10)
What is the error message you are receiving from IIS?Divestiture
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 = -2147024891Benevolent
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?Stenger
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.Benevolent
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...Coif
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?Stenger
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"Benevolent
Thank you Rico. I still can't seem to find where to add rightsBenevolent
Have you tried putting the DLL in the same folder as the .asp file as also suggested in this answer?Badly
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.Paediatrician
P
5

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.

Phototonus answered 26/12, 2012 at 0:47 Comment(2)
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.Benevolent
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. --- DougBenevolent
D
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.

Dolabriform answered 19/12, 2012 at 21:19 Comment(10)
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?Benevolent
That sounds like you just don't have a web.config file -- are there other errors?Dolabriform
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.Benevolent
web.config is an IIS thing as well as a .NET thing, so IIS will still look for it.Dolabriform
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?Benevolent
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.)Mudguard
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.Benevolent
Now that you've added the privileges, is that error gone from procmon?Dolabriform
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."Benevolent
Sorry, I've got no other ideas. :-(Dolabriform
M
1

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

Mudguard answered 19/12, 2012 at 21:15 Comment(1)
Thank you Peter, I tried that earlier. I added run and execute rights for "Everyone", "iusr_comp_name", "Network Service"Benevolent
W
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 :-)

Wild answered 11/9, 2013 at 21:34 Comment(0)
D
0

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

Drawshave answered 10/8, 2015 at 16:52 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.