So, first off, this is a problem with ThinkGeo desktop, even though it involves IIS. We use ThinkGeo desktop to generate tiles for VE. We did this with 2.0 for quite some time with no problem, but we are running into an issue now.
Below is the Event Viewer error. From working with the new API, it seems that projections are quite touchy. The protected memory error, as far as I can tell, occurs when there is an error opening or closing the projection. Perhaps a more meaninful error message would be useful. Anyways, I open the projections, and close them as well. One other thing worth noting is that the Mapsuiteprojection.dll has a constant file lock on it. Even though it's being closed properly, it's like there is something deep in the code that prevents the file lock from being released.
Any ideas what could be causing this?
Over the course of 4 days, this happened twice:
An unhandled exception occurred and the process was terminated.
Application ID: /LM/W3SVC/201890078/Root/ws/tiles
Process ID: 5868
Exception: System.AccessViolationException
Message: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
StackTrace: at ThinkGeo.MapSuite.Core.Proj4Projection.pj_free(IntPtr projPJ)
at ThinkGeo.MapSuite.Core.Proj4Projection.CloseCore()
at ThinkGeo.MapSuite.Core.Proj4Projection.Finalize()
Thanks for reporting that. That's a known issue that the Mapsuiteprojection.dll will be locked some time by unknown reason. We have put some efforts on this but so far, didn't have good result. We will focus on this and sorry for the inconvenience.
As you mentioned you have Map Suite 2.0, I think you can extend 3.0 projections with the help of MapSuiteCommon.dll in 2.0. Here is how to do it.
Imports ThinkGeo.MapSuite.Core Imports ThinkGeo.MapSuite.DesktopEdition Imports MapSuiteProjection ' from Map Suite 2.0
Public Class Form1 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim layer As New ShapeFileFeatureLayer("C:\Program Files\ThinkGeo\Map Suite Desktop Full Edition 3.0 (BETA)\Samples\SampleData\Data\USStates.shp") layer.FeatureSource.Projection = New Geodetic2Lambert() layer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.Country1 layer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20
WinformsMap1.MapUnit = GeographyUnit.DecimalDegree WinformsMap1.StaticOverlay.Layers.Add(layer) layer.Open() WinformsMap1.CurrentExtent = layer.GetBoundingBox() layer.Close() WinformsMap1.Refresh() End Sub End Class
Class Geodetic2Lambert Inherits Projection Dim LambertProj As LambertConformalConicProj Sub New() LambertProj = New LambertConformalConicProj() End Sub
Protected Overrides Function ConvertToExternalProjectionCore(ByVal x() As Double, ByVal y() As Double) As ThinkGeo.MapSuite.Core.Vertex() Dim vertices As Vertex() = New Vertex(100) {} For i As Integer = 0 To x.Length - 1 Dim LambertConformalConic As LambertConformalConic = LambertProj.GeodeticToLambertConformalConic(New Geodetic(y(i), x(i))) vertices(i) = New Vertex(LambertConformalConic.Easting, LambertConformalConic.Northing) Next Return vertices End Function
Protected Overrides Function ConvertToInternalProjectionCore(ByVal x() As Double, ByVal y() As Double) As ThinkGeo.MapSuite.Core.Vertex() Dim vertices As Vertex() = New Vertex(100) {} For i As Integer = 0 To x.Length - 1 Dim Geodetic As Geodetic = LambertProj.LambertConformalConicToGeodetic(New LambertConformalConic(x(i), y(i))) vertices(i) = New Vertex(Geodetic.Longitude, Geodetic.Latitude) Next Return vertices End Function End Class