I have written a Windows Forms application in VB.NET that creates a WCF Server. This server uses the Microsoft.Office.Interop.Access library to get a list of all of the MS Access Reports in a *.mdb file and returns that list as a List(Of String) to a client that is implemented in an ASPX page hosted on IIS on the same machine.
I built the project on my WinXP development workstation and am now trying to deploy it onto a Windows Server 2003 server. I can access most of the Interop library correctly, and the PIA is installed correctly. I get a problem on:
Expand|Select|Wrap|Line Numbers
- Public Function GetReports() As List(Of String) Implements IHarpWCF.GetReports
- Dim reports As New List(Of String)
- Try
- Dim accessReports As Microsoft.Office.Interop.Access.AllObjects
- accessReports = m_Access.CurrentProject.AllReports
- If accessReports.Count < 1 Then
- reports.Add("There are no reports in the database at " + m_targetDatabase)
- End If
- Dim iter As System.Collections.IEnumerator
- iter = accessReports.GetEnumerator()
- While iter.MoveNext()
- reports.Add(iter.Current.Name())
- End While
- Catch ex As Exception
- RaiseEvent ServerError(Me, ex.ToString())
- End Try
- Return reports
- End Function
System.Runtime.InteropServices.COMException (0x800A09A3): The expression you entered refers to an object that is closed or doesn't exist. at Microsoft.Office.Interop.Access._CurrentProject.ge t_AllReports() at Harp_WCF.HARP_WCF.GetReports().
I expect that, perhaps, the issue is that the application is being run in a different user context on the IIS machine perhaps? Could there be a security issue with using the Interop libraries on Windows Server 2003? I'm kind of out of ideas since it runs fine on my XP machine, but I have to believe that there is just some hoop I can jump through to get it working on the server.
TIA,
Jason