1. ServerCode:
Using System;
Using System. Collections. Generic;
Using System. LINQ;
Using System. Web;
Using System. Web. Services;
Using ESRI. ArcGIS. esrisystem;
Using ESRI. ArcGIS. datasourcesgdb;
Using ESRI. ArcGIS. Geodatabase;
Using ESRI. ArcGIS. geometry;
Using ESRI. ArcGIS. datasourcesfile;
[WebService (namespace = " Http://tempuri.org/ " )]
[Webservicebinding (conformsto = Wsiprofiles. basicprofile1_1)]
// To allow ASP. Net ajax to call this web service from a script, uncomment the downstream service.
// [System. Web. Script. Services. scriptservice]
Public Class Service: system. Web. Services. WebService
{
Public Service (){
// If you use the designed components, uncomment the following lines:
// Initializecomponent ();
}
[Webmethod]
Public String Helloworld ()
{
Return " Hello World " ;
}
[Webmethod]
Public Bool Addpointtofilegdb ( Double X, Double Y)
{
Iaoinitialize aoinit = New Aoinitializeclass ();
Aoinit. initialize (esrilicenseproductcode. esrilicenseproductcodearcserver );
Iworkspacefactory pwsf = New ESRI. ArcGIS. datasourcesgdb. filegdbworkspacefactoryclass () As Iworkspacefactory;
ESRI. ArcGIS. esrisystem. ipropertyset ppropertyset = New ESRI. ArcGIS. esrisystem. propertysetclass ();
Ppropertyset. setproperty ( " Database " , @" D: \ data \ new file Geodatabase. GDB " );
Ifeatureworkspace pfw = Pwsf. Open (ppropertyset, 0 ) As Ifeatureworkspace;
Ipoint Ppoint = New Pointclass ();
Ppoint. x = X;
Ppoint. Y = Y;
Ifeatureclass PFC = Pfw. openfeatureclass ( " Point " );
Ifeature pf = PFC. createfeature ();
PF. Shape = Ppoint;
PF. Store ();
Return True ;
}
}
2 client code:
Using system; using system. collections. generic; using system. LINQ; using system. web; using system. web. ui; using system. web. UI. webcontrols; public partial class _ default: system. web. UI. page {protected void page_load (Object sender, eventargs e) {} protected void button#click (Object sender, eventargs e) {addpointserver. service Se = new addpointserver. service (); se. addpointtofilegdbcompleted + = new ADDP Ointserver. addpointtofilegdbcompletedeventhandler (se_addpointtofilegdbcompleted); se. addpointtofilegdbasync (double. parse (textbox1.text), double. parse (textbox2.text);} void se_addpointtofilegdbcompleted (Object sender, addpointserver. addpointtofilegdbcompletedeventargs e) {response. write ("done! ");}}
3. Note: The directory where file GDB is located must have the read and write permissions for the ASPnet and NetworkService roles. Otherwise, the file GDB cannot be read or written.
4. How can I makeFolder PropertiesPage has"Security"Tab? The solution is as follows:
1, Open Resource Manager 2, Go to the tool-Folder option menu and switch to the "View" tab. 3, Remove the "use simple file sharing (recommended)" option