Common_WebMappingApp_VBNet\App_Code\Native64BitSupport.vb
' Copyright 2011 ESRI ' ' All rights reserved under the copyright laws of the United States ' and applicable international laws, treaties, and conventions. ' ' You may freely redistribute and use this sample code, with or ' without modification, provided you include the original copyright ' notice and use restrictions. ' ' See the use restrictions. ' #Const Native64BitApplication = False Imports System Imports System.Collections.Generic Imports System.Web Imports ESRI.ArcGIS.ADF.Web.UI.WebControls Imports System.Web.SessionState ' To run this application in a 64-bit application pool: ' 1) Set the "#Const Native64BitApplication" compiler constant to True at the top of this file. ' 2) Comment out the two sections in the web.config file beginning with "<!--Begin Remove for 64-bit native deployment-->" ' and ending with "<!--End Remove for 64-bit native deployment-->" ' 3) Search for "esriEditor:EditorTask" in the .skin files and delete the entire XML element. ' Support for functionality specific to ArcGIS Server Local datasources. Public Class ArcGISServerLocalSupport Public Shared Function HasNonPooledResources(ByVal mapManager As MapResourceManager, ByVal geocodeManager As GeocodeResourceManager, ByVal geoproccessingManager As GeoprocessingResourceManager) As Boolean #If Native64BitApplication Then Return False #Else Return ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer.GISDataSourceLocal.HasNonPooledServices(mapManager) _ Or ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer.GISDataSourceLocal.HasNonPooledServices(geocodeManager) _ Or ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer.GISDataSourceLocal.HasNonPooledServices(geoproccessingManager) #End If End Function 'HasNonPooledResources Public Shared Sub ReleaseNonPooledContexts() #If Native64BitApplication Then Return #Else ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer.GISDataSourceLocal.ReleaseNonPooledContexts(HttpContext.Current.Session) #End If End Sub 'ReleaseNonPooledContexts Public Shared Sub SessionCleanup() Dim session As HttpSessionState = HttpContext.Current.Session #If Native64BitApplication Then ' Code that runs when a session is abandoned. Dim i As Integer For i = 0 To session.Count - 1 If TypeOf session(i) Is IDisposable Then CType(session(i), IDisposable).Dispose() End If Next i #Else Dim contexts As New System.Collections.Generic.List(Of ESRI.ArcGIS.Server.IServerContext) Dim i As Integer For i = 0 To session.Count - 1 If TypeOf session(i) Is ESRI.ArcGIS.Server.IServerContext Then contexts.Add(CType(session(i), ESRI.ArcGIS.Server.IServerContext)) Else If TypeOf session(i) Is IDisposable Then CType(session(i), IDisposable).Dispose() End If End If Next i Dim context As ESRI.ArcGIS.Server.IServerContext For Each context In contexts context.RemoveAll() context.ReleaseContext() Next context #End If End Sub 'SessionCleanup ' End Class 'ArcGISServerLocalSupport