Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/csharp-4.0/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在geoserver中使用c#进行复制_C#_C# 4.0_Geoserver - Fatal编程技术网

在geoserver中使用c#进行复制

在geoserver中使用c#进行复制,c#,c#-4.0,geoserver,C#,C# 4.0,Geoserver,有人知道如何使用C#在geoserver中复制文件(工作空间、形状等)的文档或示例吗 请看一下您的文档。向下滚动到“工作空间”部分,您会注意到需要向服务器发送一个GET/POST/PUT方法,用于创建/复制工作空间。此C代码将在GeoServer上创建一个新工作空间 using System; using System.Net; using System.IO; ... string url = "http://localhost:8080/geoserver/rest/workspaces

有人知道如何使用C#在geoserver中复制文件(工作空间、形状等)的文档或示例吗

请看一下您的文档。向下滚动到“工作空间”部分,您会注意到需要向服务器发送一个GET/POST/PUT方法,用于创建/复制工作空间。

此C代码将在GeoServer上创建一个新工作空间

using System;
using System.Net;
using System.IO;

...

string url = "http://localhost:8080/geoserver/rest/workspaces";
WebRequest request = WebRequest.Create(url);

request.ContentType = "text/xml";
request.Method = "POST";
request.Credentials = new NetworkCredential("admin", "geoserver");

byte[] buffer = Encoding.GetEncoding("UTF-8").GetBytes("<workspace><name>my_workspace</name></workspace>");
Stream reqstr = request.GetRequestStream();
reqstr.Write(buffer, 0, buffer.Length);
reqstr.Close();

WebResponse response = request.GetResponse();

...
使用系统;
Net系统;
使用System.IO;
...
字符串url=”http://localhost:8080/geoserver/rest/workspaces";
WebRequest=WebRequest.Create(url);
request.ContentType=“text/xml”;
request.Method=“POST”;
request.Credentials=newnetworkcredential(“admin”、“geoserver”);
byte[]buffer=Encoding.GetEncoding(“UTF-8”).GetBytes(“我的工作区”);
Stream reqstr=request.GetRequestStream();
请求写入(缓冲区,0,缓冲区长度);
请求关闭();
WebResponse=request.GetResponse();
...
GeoServer提供了有关如何使用cURL创建工作空间、存储、图层和样式的示例:。
然后,您可以使用上面的代码转换cURL示例。

谢谢,但对我来说,Geoserver页面的帮助不大。