Hi,
I am trying to create a standalone Core Host application to update a featureclass in a scheduled task.
I am running into an issue trying to use Host.Initialize(Host.LicenseProductCode.ArcGISServer).
The license is showing that it is initializing with an Advanced License level, but later in the code I am not able to make a connection to an Enterprise Geodatabase. I have a try catch block around it, but if there is an error, it is not getting caught.
Here is the code that crashes:
Dim gottenFeatureClass As FeatureClass = Nothing
DeedsUpdateLog.WriteToLogFile("Setting up connection properties for Deeds Feature Layer on " & instance & ".")
Dim connProps As New DatabaseConnectionProperties(EnterpriseDatabaseType.SQLServer)
connProps.AuthenticationMode = AuthenticationMode.DBMS
connProps.Instance = instance
connProps.Database = "Property"
connProps.User = usrUser
connProps.Password = usrPassword
connProps.Version = "sde.DEFAULT"
DeedsUpdateLog.WriteToLogFile("Connecting to the geodatabase.")
Dim theGeodatabase As Geodatabase = New Geodatabase(connProps)
Try
DeedsUpdateLog.WriteToLogFile("Opening the deeds featureclass.")
gottenFeatureClass = theGeodatabase.OpenDataset(Of FeatureClass)(featClassName)
DeedsUpdateLog.WriteToLogFile("Deeds featureclass opened.")
Catch ex As Exception
DeedsUpdateLog.WriteToLogFile("Error.")
gottenFeatureClass = Nothing
Throw ex
Finally
theGeodatabase.Dispose()
End Try
Return gottenFeatureClass
It crashes at line: "Dim theGeodatabase As Geodatabase = New Geodatabase(connProps)" because I am getting the log message "Connecting to the geodatabase.", but nothing else in my log after that.
It is a console application, so the console window (cmd window) opens momentarily and then dissapears, with no error messages at all. I think it is because I am trying to use ArcGIS Server to initialize, if I use Host.Initialize(Host.LicenseProductCode.ArcGISPro) the whole process completes from start to finish.
Any ideas?