arcgis application which publishes a map on arcgis server

318
1
Jump to solution
06-01-2014 11:17 PM
MariusRata
New Contributor
Hello Community !

I'm new into ArcGIS / ArcGIS developers. I am running on  Windows 7, Visual Studio .NET 2012. I program in C#.  I would be interested in creating a simple application which would take as input a map and then publish it on the ArcGIS Server which would expose it to world. Its my first project, so I don't know where to start from. Can you  point me what sort of ArcGIS project should I start or a simple "Hello World" application for my task?

Thanks,
Duktech.
0 Kudos
1 Solution

Accepted Solutions
TerryGiles
Occasional Contributor III
I could be wrong but I think python is the only way to publish a map service programmatically these days.  But doing so is fairly simple just write a python script which calls the 3 publishing tools (CreateMapSDDraft, StageService, UploadServiceDefinition) and call the python script in your C# code -

//mxdfolder, mxd are variables for the mxd on the local system; serverFolder is the folder on my ArcGIS Server to publish the mapservice in string pypath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location) + "\\publisher.py";  ProcessStartInfo psi = new ProcessStartInfo(ConfigurationManager.AppSettings["PythonPath"] + "\\python.exe", pypath + " " + mxdfolder + " " + mxd + " " +serverFolder); psi.UseShellExecute = false; using (Process proc = Process.Start(psi)) {          proc.WaitForExit(); }


If you look at the online help for the publishing python tools, there's a complete working example of the python to use, just adapt to your needs.

Terry

View solution in original post

0 Kudos
1 Reply
TerryGiles
Occasional Contributor III
I could be wrong but I think python is the only way to publish a map service programmatically these days.  But doing so is fairly simple just write a python script which calls the 3 publishing tools (CreateMapSDDraft, StageService, UploadServiceDefinition) and call the python script in your C# code -

//mxdfolder, mxd are variables for the mxd on the local system; serverFolder is the folder on my ArcGIS Server to publish the mapservice in string pypath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location) + "\\publisher.py";  ProcessStartInfo psi = new ProcessStartInfo(ConfigurationManager.AppSettings["PythonPath"] + "\\python.exe", pypath + " " + mxdfolder + " " + mxd + " " +serverFolder); psi.UseShellExecute = false; using (Process proc = Process.Start(psi)) {          proc.WaitForExit(); }


If you look at the online help for the publishing python tools, there's a complete working example of the python to use, just adapt to your needs.

Terry
0 Kudos