我有 WCF 服务,其方法发送路径如下:“C:\asdf\log.log”。
客户端获取“C:\\asdf\\log.log”
问题出在哪里,如何解决?
发送代码
MemoryStream stream1 = new MemoryStream();
DataContractJsonSerializer ser =
new DataContractJsonSerializer(typeof(ConfSettings));
ser.WriteObject(stream1, this);
stream1.Position = 0;
StreamReader sr = new StreamReader(stream1);
string tmp = sr.ReadToEnd();
return (tmp);
重新筛选代码
Stream dataStream = response.GetResponseStream();
StreamReader reader = new StreamReader(dataStream);
string responseFromServer = reader.ReadToEnd();
string result = responseFromServer;
string tmp = result
byte[] bytes = new byte[tmp.Length * sizeof(char)];
System.Buffer.BlockCopy(tmp.ToCharArray(), 0, bytes, 0, bytes.Length);
MemoryStream memStream = new MemoryStream(bytes, 2, bytes.Length-4);
DataContractJsonSerializer ser =
new DataContractJsonSerializer(typeof(ConfSettings));
conf = (ConfSettings)ser.ReadObject(memStream);