I think I can live with the first error.Tried below code after enabling runtime on GPK - still getting more errors.Please let me know how to upload the gpk file..
private static string gpkPath = @"C:\arcgis-runtime-samples-dotnet-master\samples-
data\geoprocessing\TableToExcel\TableToExcel.gpk";
private Geoprocessor _gpTask;
private async void StartButton_Click(object sender, RoutedEventArgs e)
{
try
{
var gpService = new LocalGeoprocessingService(gpkPath, GeoprocessingServiceType.Execute);
await gpService.StartAsync();
string gpUrl = gpService.UrlGeoprocessingService;
_gpTask = new Geoprocessor(new Uri(gpUrl + "/TableToExcel"));
GetServiceInfo();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Sample Error");
}
}
private async void GetServiceInfo()
{
string message = null;
try
{
var result = await _gpTask.GetTaskInfoAsync();
var sb = new StringBuilder();
if (result != null)
{
sb.Append("{");
sb.AppendLine(string.Format("\t\"name\" : \"{0}\",", result.Name));
sb.AppendLine(string.Format("\t\"displayName\" : \"{0}\",", result.DisplayName));
sb.AppendLine(string.Format("\t\"category\" : \"{0}\",", result.Category));
sb.AppendLine(string.Format("\t\"helpUrl\" : \"{0}\",", result.HelpUrl));
sb.AppendLine(string.Format("\t\"executionType\" : \"esriExecutionType{0}\",", result.ExecutionType));
sb.AppendLine("\t\"parameters\" : [");
foreach (var p in result.Parameters)
{
sb.AppendLine("\t{");
sb.AppendLine(string.Format("\t\t\"name\" : \"{0}\",", p.Name));
sb.AppendLine(string.Format("\t\t\"dataType\" : \"{0}\",", p.DataType));
sb.AppendLine(string.Format("\t\t\"displayName\" : \"{0}\",", p.DisplayName));
sb.AppendLine(string.Format("\t\t\"direction\" : \"esriGPParameterDirection{0}\",", p.Direction));
sb.AppendLine(string.Format("\t\t\"defaultValue\" : \"{0}\",", p.DefaultValue));
sb.AppendLine(string.Format("\t\t\"parameterType\" : \"esriGPParameterType{0}\",", p.ParameterType));
sb.AppendLine(string.Format("\t\t\"category\" : \"{0}\"", p.Category));
if (p.ChoiceList != null)
{
sb.AppendLine("\t\t\"choiceList\" : [");
foreach (var c in p.ChoiceList)
sb.AppendLine(string.Format("\t\t\t\"{0}\"", c));
sb.AppendLine("\t\t\"]");
}
sb.AppendLine("\t},");
}
sb.AppendLine("\t]");
sb.Append("}");
message = sb.ToString();
}
}
catch (Exception ex)
{
message = ex.Message;
}
MessageBox.Show(message, "Service Info");
}