Select to view content in your preferred language

Create Map Service with local map document (mxd)

1215
0
01-05-2011 11:12 PM
StefanOffermann
Deactivated User
Hi,

is it possible to create a MapService programmatically in .NET by using the local path of the map document (the mxd file)? Right now, I have a desktop extension importing some shape files so sde, creating layers by an xml configuration, and saving the document to a local path. Lets call this machine A. (the mxd is saved at C:\maps\mymap.mxd).

Now this map should be used to create a map service on ArcGIS Server "B". The following code works fine, if the path to the mxd is an UNC path:

var serverConfig = (IServerObjectConfiguration3)serverAdmin.CreateConfiguration();
var pProps = serverConfig.Properties;
pProps.SetProperty("FilePath", @"\\fileserver\maps\mymap.mxd");


But if I have no fileserver? (I know this case is rarely seen, but in my project it makes sense).

This does not work (because the server B does not have access to the local file on A):
pProps.SetProperty("FilePath", @"C:\maps\mymap.mxd");


Is there a way to easily copy the mxd to the server with ArcObjects? How can I achieve this programmatically? Or do I have to somehow develop a "file copy" mechanism myself?

Best regards,
Stefan
0 Kudos
0 Replies