/// <summary> /// /// </summary> /// <param name="name"></param> /// <param name="port"></param> /// <param name="strType">DataSourceType enum + custom online maps</param> /// <param name="dataSorucePath"></param> /// <param name="disableClientCache"></param> /// <param name="displayNoDataTile"></param> /// <param name="style"></param> /// <param name="tilingSchemePath">Set this parameter only when type is ArcGISDynamicMapService and do not use Google Maps's tiling scheme</param> /// <returns>errors or warnings. string.empty if nothing wrong.</returns> public static string CreateService(string name, int port, string strType, string dataSorucePath, bool allowMemoryCache, bool disableClientCache, bool displayNoDataTile, VisualStyle style, string tilingSchemePath = null) { PBSServiceProvider serviceProvider = null; string str; if (!PortEntities.ContainsKey(port)) { str = StartServiceHost(port); if (str != string.Empty) { return(str); } } serviceProvider = PortEntities[port].ServiceProvider; if (serviceProvider.Services.ContainsKey(name)) { return("Servicename already exists!"); } PBSService service; try { service = new PBSService(name, dataSorucePath, port, strType, allowMemoryCache, disableClientCache, displayNoDataTile, style, tilingSchemePath); } catch (Exception e)//in case of reading conf.xml or conf.cdi file error|| reading a sqlite db error { Utility.Log(LogLevel.Error, null, "Creating New Service(" + name + ") Error!\r\nData Source: " + dataSorucePath + "\r\n\r\n" + e.Message); return("Creating New Service(" + name + ") Error!\r\nData Source: " + dataSorucePath + "\r\n\r\n" + e.Message); } serviceProvider.Services.Add(name, service); //for process http request Services.Add(service); //for ui binding return(string.Empty); }
} //services at the same port public PortEntity(WebServiceHost host, PBSServiceProvider provider) { ServiceHost = host; ServiceProvider = provider; }