<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Create Map Service with local map document (mxd) in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/create-map-service-with-local-map-document-mxd/m-p/4610#M127</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;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).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;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:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;var serverConfig = (IServerObjectConfiguration3)serverAdmin.CreateConfiguration();
var pProps = serverConfig.Properties;
pProps.SetProperty("FilePath", @"\\fileserver\maps\mymap.mxd");&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;But if I have no fileserver? (I know this case is rarely seen, but in my project it makes sense).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This does not work (because the server B does not have access to the local file on A):&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;pProps.SetProperty("FilePath", @"C:\maps\mymap.mxd");&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;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?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Best regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Stefan&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 06 Jan 2011 07:12:00 GMT</pubDate>
    <dc:creator>StefanOffermann</dc:creator>
    <dc:date>2011-01-06T07:12:00Z</dc:date>
    <item>
      <title>Create Map Service with local map document (mxd)</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/create-map-service-with-local-map-document-mxd/m-p/4610#M127</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;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).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;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:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;var serverConfig = (IServerObjectConfiguration3)serverAdmin.CreateConfiguration();
var pProps = serverConfig.Properties;
pProps.SetProperty("FilePath", @"\\fileserver\maps\mymap.mxd");&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;But if I have no fileserver? (I know this case is rarely seen, but in my project it makes sense).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This does not work (because the server B does not have access to the local file on A):&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;pProps.SetProperty("FilePath", @"C:\maps\mymap.mxd");&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;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?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Best regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Stefan&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Jan 2011 07:12:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/create-map-service-with-local-map-document-mxd/m-p/4610#M127</guid>
      <dc:creator>StefanOffermann</dc:creator>
      <dc:date>2011-01-06T07:12:00Z</dc:date>
    </item>
  </channel>
</rss>

