Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Accessing COM dll.  Works in Visual Studio but not when published in IIS.

Posted on 2009-07-02
6
Medium Priority
?
462 Views
Last Modified: 2013-11-26
I have a simple ASP.NET test page that calls a method in a COM dll.  When running from within Visual Studio, using Visual Studio's web server, things work fine.  When I attempt to run the page outside of Visual Studio via IIS, the pagel errors with the HRESULT: 0x80020009 (DISP_E_EXCEPTION) error.  The error occurs at the line of the COM method call.

I don't understand what's different when executing through IIS.  The dll is registered, otherwise it wouldn't work within VS.  I've tried copying the dll locally to my website's bin folder but that doesn't help.
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
 
        Dim i As Integer
        Dim strUserid As Object
        Dim strUserName As Object
'
'
        strUserid = "DEMO"
        strUserName = "PASSWORD"
'
        mRMCom = New RMIFCLLib.Client
'
        Try
            i = mRMCom.Logon("AUTOSTORE", strUserid, strUserName ) ' ERROR OCCURS HERE
        Catch Ex As Exception
            Me.Label1.Text = Ex.Message
            Return
        End Try
'
        i = mRMCom.GetFirstUserID(strUserid, strUserName)
        While (i >= 0)
            Me.ListBox1.Items.Add(strUserid & ", " & strUserName)
            i = mRMCom.GetNextUserID(strUserid, strUserName)
        End While
'
 End Sub

Open in new window

0
Comment
Question by:cdsouthern
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 25

Expert Comment

by:SStory
ID: 24765512
Things like this are usually a permissions problem.  When you run in Visual Studio, I guess you are running as you, but when you hit it from IIS you are running as

IUSR_<yourmachinename> user account.
This account must have permissions to the DLL....if it is in another location.

See this:
http://support.softartisans.com/kbview_883.aspx

be sure the above user account has proper permissions for the .dll and folder it is in
0
 

Author Comment

by:cdsouthern
ID: 24765993
I have provided Full Access to both the ASPNET user and IUSR_<machinename> accounts for the folder containing the COM dll.  I also tried copying the dll to the bin folder in the website.  No luck with either.
0
 
LVL 25

Expert Comment

by:SStory
ID: 24766426
OK. how about permissions on the com dll itself. Does IUSR have permissions to the file?
0
Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

 

Author Comment

by:cdsouthern
ID: 24766501
Yes, it has the same permissions as the containing folder.  Looks like it inherited the folder permissions.
0
 
LVL 25

Accepted Solution

by:
SStory earned 2000 total points
ID: 24767609
I'm sorry, I don't know why. Most of the things I found on MSDN and Google were related to SharePoint and this doesn't seem to be SharePoint.

Possibilities.  Does the COM object read the registry? If so does IUSR have rights to those keys?

You might go to sysinternals.com and download filemon and regmon, run them on the IIS server and when you hit this page see what it is trying to access and if there are any access denied messages.

Other than this I don't know what more to suggest.
0
 

Author Closing Comment

by:cdsouthern
ID: 31599265
The COM dll does read from the registry.  The solution was to give the local user ASPNET proper access to the appropriate registry key (RMCLIENT32 in our case).
0

Featured Post

Moving data to the cloud? Find out if you’re ready

Before moving to the cloud, it is important to carefully define your db needs, plan for the migration & understand prod. environment. This wp explains how to define what you need from a cloud provider, plan for the migration & what putting a cloud solution into practice entails.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question