arcobjects api(二)

来源:互联网 发布:南大网络教育答案2017 编辑:程序博客网 时间:2024/05/05 18:11

1.在服务端创建文件 

ESRI.ArcGIS.ADF.Identity identity = new ESRI.ArcGIS.ADF.Identity("a", "a", "su");
            ESRI.ArcGIS.ADF.Connection.AGS.AGSServerConnection ags_connection;
            ags_connection = new ESRI.ArcGIS.ADF.Connection.AGS.AGSServerConnection("su", identity);
            ags_connection.Connect();
            IServerObjectManager pSOM = ags_connection.ServerObjectManager;
            IServerContext pServerContext = pSOM.CreateServerContext("", "");

            IMapServer pMapServer = pServerContext.ServerObject as IMapServer;

 

            IWorkspaceFactory pWSF = pServerContext.CreateObject("esriDataSourcesGDB.AccessWorkspaceFactory") as IWorkspaceFactory;

            IEnumServerDirectoryInfo pEnumSDI = pSOM.GetServerDirectoryInfos() as IEnumServerDirectoryInfo;
            IServerDirectoryInfo pSDI = pEnumSDI.Next();

            IPropertySet pProps = pServerContext.CreateObject("esriSystem.PropertySet") as IPropertySet;

//_ags_前缀,arcgis会自动删除
            pProps.SetProperty ("DATABASE", pSDI.Path + "_ags_db1.mdb");
            pWSF.Create (pSDI.Path, "_ags_db1", pProps, 0);


            pProps.SetProperty ("DATABASE", pSDI.Path + "db2.mdb");
            pWSF.Create (pSDI.Path, "db2", pProps, 0);

原创粉丝点击