Professional Documents
Culture Documents
'...Connect to ServerObjectManager
Dim pServerObjectManager As ESRI.ArcGIS.Server.IServerObjectManager
pServerObjectManager = Mygisconnection.ServerObjectManager
'...Sing in ServerObjectAdministrator
Dim pServerObjectAdmin As ESRI.ArcGIS.Server.IServerObjectAdmin
pServerObjectAdmin = Mygisconnection.ServerObjectAdmin
‘... Since it is a web application so replace the path with the server name
Dim path As String = MyMXDFilePath
path = path.Replace("C:", "\\" + pServerName)
'... if the map serivce is not found, add the MapService to the server.
If pExist = False Then
Try
pServerObjectAdmin.AddConfiguration(pConfiguration)
pServerObjectAdmin.StartConfiguration(pConfiguration.Name, _
pConfiguration.TypeName)
Catch
MsgBox("Please set the folder to be shared or unable to create a map service")
End Try
End If
'...Release memory
Mygisconnection = Nothing
pServerObjectManager = Nothing
pServerObjectAdmin = Nothing
pProps = Nothing
pEnumConfigInfo = Nothing
pConfigInfo = Nothing
pConfiguration = Nothing
End Sub
Note: This VB (6 or .Net) sample code and/or comments contained herein are provided “as is” without any warranty. The site-
www.shapefile.us shall not be liable for direct, indirect, special, incidental, or consequential damages related to any decisions you
make by using any of the information and/or materials listed and/or posted on this page.