retrieving the COM class factory for component with CLSID {D9B4FA40-D6D9-11D1-AA81-00C04FA33A15}failed due to the following error: 80040111

4620
9
Jump to solution
06-22-2017 12:51 PM
JoseSanchez
Occasional Contributor III

Hello everyone,

I  wrote a web service a few months ago, and it was working fine. Then I decided to upgrade my workstation to ArcGIS Server 10.3 and it stopped working. So I uninstalled AcGIS Server 10.3 and I installed back ArcGIS Server 10.2 and the web service still does not work.

I am using ArcGIS 10.2 client and server on my workstation. IIS .Net Framework 3.5 and  ApplicationPool 2.0, VS 2010 or VS 2012. I also did tests with IIS .Net Framework 4.0 and Application Pool 4.0 and the error persists.

Please take a look to the zipped file attached to this post. It is a simplified version of the web service, it can be opened with  VS 2010 or VS 2012. The line that has the problem is this one: "CType(Activator.CreateInstance(factoryType), ESRI.ArcGIS.Geodatabase.IWorkspaceFactory)", it fails with an error message "retrieving the COM class factory for component with CLSID {D9B4FA40-D6D9-11D1-AA81-00C04FA33A15}failed due to the following error: 80040111."

Also I created a Console Application using the same code and it works fine.

HELP!!!!!

<WebMethod()> _

Public Function HelloWorld() As String

 

' For example, connectionFile = "C:\myData\Connection to Kona.sde".

'Public Function ArcSdeWorkspaceFromFile(ByVal connectionFile As String) As IWorkspace

Try

Dim connectionFile As String

Dim factoryType As Type = Type.GetTypeFromProgID("esriDataSourcesGDB.SdeWorkspaceFactory")

Dim workspaceFactory As ESRI.ArcGIS.Geodatabase.IWorkspaceFactory = Nothing

Dim wsFactory As ESRI.ArcGIS.Geodatabase.IWorkspaceFactory = Nothing

'

' This is where I get the error message:

' Retrieving the COM class factory for component with CLSID {D9B4FA40-D6D9-11D1-AA81-00C04FA33A15}

' failed due to the following error: 80040111.

'

'

workspaceFactory = CType(Activator.CreateInstance(factoryType), ESRI.ArcGIS.Geodatabase.IWorkspaceFactory)

 ....

Catch ex As Exception

Console.WriteLine(ex.Message)

 

Return ex.Message

End Try

'End Sub

 

 

Return "Hello World"

End Function

0 Kudos
1 Solution

Accepted Solutions
sapnas
by
Occasional Contributor III
0 Kudos
9 Replies
sapnas
by
Occasional Contributor III

Is your Enable 32-bit applications property in IIS app pool  set to True by any chance?

0 Kudos
JoseSanchez
Occasional Contributor III

Where do you  set up this value in IIS?

0 Kudos
JoseSanchez
Occasional Contributor III

Just checked, and the value is set to True.

0 Kudos
sapnas
by
Occasional Contributor III

Set it to false

0 Kudos
JoseSanchez
Occasional Contributor III

Hi Spana,

I set it to False and the line where it was failing does not fail anymore.

Now  I am getting an error message on the next line of the code:  workspaceFactory.OpenFromFile(connectionFile, 0)  with error message:

Error HRESULT E_FAIL has been returned from a call to a COM component.

connectionFile = "C:\SDEConn\SDEINSTANCE.sde"

Dim myIWorkspace As IWorkspace

myIWorkspace = workspaceFactory.OpenFromFile(connectionFile, 0)   ********* ERROR MESSAGE

0 Kudos
JoseSanchez
Occasional Contributor III

Found it!!!  The IIS account IIS_IUSRS must be added to the folder where SDE Connection files are located in read only access. Otherwise the ASP.Net application can no read the folder.

0 Kudos
sapnas
by
Occasional Contributor III

That is correct if the IIS authentication is Anonymous IIS_USRS should have access to that folder

JoseSanchez
Occasional Contributor III

Hello again,

the application was working fine last Friday but today I am getting the error message below in this line:

workspaceFactory = CType(Activator.CreateInstance(factoryType), ESRI.ArcGIS.Geodatabase.IWorkspaceFactory)

Error message:

Retrieving the COM class factory for component with CLSID {D9B4FA40-D6D9-11D1-AA81-00C04FA33A15} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).

Any suggestions

0 Kudos
JoseSanchez
Occasional Contributor III

Found it! I just removed and added two references: Esri.ArcGIs.Geodatabae and EsriArcGIS.Syste, and it works now.

0 Kudos