schangxiang@126.com
2025-11-04 f5ed29dc26c7cd952d56ec5721a2efc43cd25992
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.IO;
using System.Net;
using System.Net.Security;
using System.Text;
using XImaging.Automation.Library.HxDriverLib;
 
namespace XImaging.Automation.Service
{
    public class PostServerConfig : ConfigurationElement
    {
        [ConfigurationProperty("name", IsRequired = true)]
        public string Name
        {
            get { return (string)this["name"]; }
        }
 
        [ConfigurationProperty("method", IsRequired = true)]
        public string Method
        {
            get { return (string)this["method"]; }
        }
 
        [ConfigurationProperty("uri", IsRequired = true)]
        public string URI
        {
            get { return (string)this["uri"]; }
        }
    }
 
    public class PostServerSection : ConfigurationSection
    {
        [ConfigurationProperty("server", IsRequired = true)]
        public PostServerConfig Server
        {
            get { return this["server"] as PostServerConfig; }
        }
    }
 
    public class MessageConfig : ConfigurationElement
    {
        [ConfigurationProperty("enabled", IsRequired = true)]
        public bool Enabled
        {
            get { return (bool)this["enabled"]; }
        }
 
        [ConfigurationProperty("timeout", IsRequired = true)]
        public int Timeout
        {
            get { return (int)this["timeout"]; }
        }
    }
 
    public class MessageSection : ConfigurationSection
    {
        [ConfigurationProperty("heartbeat", IsRequired = true)]
        public MessageConfig Heartbeat
        {
            get { return this["heartbeat"] as MessageConfig; }
        }
    }
 
    public class HttpRequestClient
    {
        /// <summary>
        /// 获取或设置数据字符编码, 默认使用<see cref="System.Text.Encoding.UTF8"/>
        /// </summary>
        public Encoding Encoding { get; set; } = Encoding.UTF8;
 
        /// <summary>
        /// 获取或设置 UserAgent
        /// </summary>
        public string UserAgent { get; set; } = "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36";
 
        /// <summary>
        /// 获取或设置 Accept
        /// </summary>
        public string Accept { get; set; } = "*/*";
 
        /// <summary>
        /// 获取或设置 Referer
        /// </summary>
        public string Referer { get; set; }
 
        /// <summary>
        /// 获取或设置 Cookie 容器
        /// </summary>
        public CookieContainer CookieContainer { get; set; } = new CookieContainer();
 
        public virtual string Post(string url)
        {
            return null;
        }
        /// <summary>
        /// 初始化一个用于以 POST 方式向目标地址提交不包含文件表单数据<see cref="HttpPostRequestClient"/>实例
        /// </summary>
        public HttpRequestClient()
        {
        }
    }
 
    internal sealed class BiosenHttpRequestClient : HttpRequestClient
    {
        public static string Uri { set; get; }
 
        private JObject _postDatas;
        private static string SO_DELIMITER = "#!HxSEP!#";
        private string m_strName;
        private string m_strPayload;
 
        public static void Init()
        {
            PostServerSection section = ConfigurationManager.GetSection("dataServer") as PostServerSection;
            BiosenHttpRequestClient.Uri = section.Server.URI;
        }
 
        public BiosenHttpRequestClient() : base()
        {
            this._postDatas = JObject.FromObject(new { });
        }
 
        /// <summary>
        /// 以POST方式向目标地址提交表单数据
        /// </summary>
        /// <param name="url">目标地址, http(s)://sample.com</param>
        /// <returns>目标地址的响应</returns>
        public override string Post(string url)
        {
            if (string.IsNullOrWhiteSpace(url))
                throw new ArgumentNullException(nameof(url));
 
            HttpWebRequest request = null;
            if (url.ToLowerInvariant().StartsWith("https"))
            {
                request = WebRequest.Create(url) as HttpWebRequest;
                ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback((s, c, ch, ss) => { return true; });
                request.ProtocolVersion = HttpVersion.Version11;
                ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls;
                request.KeepAlive = true;
                ServicePointManager.CheckCertificateRevocationList = true; ServicePointManager.DefaultConnectionLimit = 100;
                ServicePointManager.Expect100Continue = false;
            }
            else
            {
                request = WebRequest.Create(url) as HttpWebRequest;
            }
            
            request.Timeout = 3000;
            request.Method = "POST";
            request.ContentType = "application/json";
            request.UserAgent = this.UserAgent;
            request.Accept = this.Accept;
            request.Referer = this.Referer;
            request.CookieContainer = this.CookieContainer;
 
            string postData = this._postDatas.ToString();
            try
            {
                using (var streamWriter = new StreamWriter(request.GetRequestStream()))
                {
                    streamWriter.Write(postData);
                }
            }
            catch(Exception ex)
            {
                LogConstant.logger.Print(string.Format("[Post][Exception]{0}", ex.ToString()));
            }
 
            LogConstant.logger.Print(string.Format("[Post][Data]准备向[{0}]发送消息: {1}", url, postData));
            string resContent = "";
            try
            {
                HttpWebResponse response = request.GetResponse() as HttpWebResponse;
                using (Stream resStream = response.GetResponseStream())
                {
                    using (StreamReader streamReader = new StreamReader(resStream, Encoding.UTF8))
                    {
                        resContent = streamReader.ReadToEnd().ToString();
                    }
                }
 
                LogConstant.logger.Print(string.Format("[Post][Data]消息发送成功,从[{0}]收到返回消息: {1}", url, resContent));
                return resContent;
            }
            catch (Exception ex)
            {
                LogConstant.logger.Print("[Post][Data]消息发送失败,未收到返回消息:" + ex.Message);
                throw ex;
            }
        }
 
        public static void Send(string data)
        {
            BiosenHttpRequestClient client = new BiosenHttpRequestClient();
            client.Payload = data;
            string t_response = client.Post(BiosenHttpRequestClient.Uri + "?name=" + client.m_strName);
            return;
        }
 
        public string Payload
        {
            set
            {
                this.m_strPayload = value;
                this.m_strName = XImaging.Automation.Library.HxDriverLib.Encrypt.md5(this.m_strPayload + SO_DELIMITER);
                this._postDatas = JObject.Parse(this.m_strPayload);
            }
            get
            {
                return m_strPayload;
            }
        }
    }
 
    internal sealed class BiosenErrorRequestClient : HttpRequestClient
    {
        public static string Uri { set; get; }
 
        private JObject _postDatas;
        private static string SO_DELIMITER = "#!HxSEP!#";
        private string m_strName;
        private string m_strPayload;
 
        public static void Init()
        {
            PostServerSection section = ConfigurationManager.GetSection("errorServer") as PostServerSection;
            BiosenErrorRequestClient.Uri = section.Server.URI;
        }
 
        public BiosenErrorRequestClient() : base()
        {
            this._postDatas = JObject.FromObject(new { });
        }
 
        /// <summary>
        /// 以POST方式向目标地址提交表单数据
        /// </summary>
        /// <param name="url">目标地址, http(s)://sample.com</param>
        /// <returns>目标地址的响应</returns>
        public override string Post(string url)
        {
            if (string.IsNullOrWhiteSpace(url))
                throw new ArgumentNullException(nameof(url));
 
            HttpWebRequest request = null;
            if (url.ToLowerInvariant().StartsWith("https"))
            {
                request = WebRequest.Create(url) as HttpWebRequest;
                ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback((s, c, ch, ss) => { return true; });
                request.ProtocolVersion = HttpVersion.Version11;
                ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls;
                request.KeepAlive = true;
                ServicePointManager.CheckCertificateRevocationList = true; ServicePointManager.DefaultConnectionLimit = 100;
                ServicePointManager.Expect100Continue = false;
            }
            else
            {
                request = WebRequest.Create(url) as HttpWebRequest;
            }
 
            request.Timeout = 3000;
            request.Method = "POST";
            request.ContentType = "application/json";
            request.UserAgent = this.UserAgent;
            request.Accept = this.Accept;
            request.Referer = this.Referer;
            request.CookieContainer = this.CookieContainer;
 
            string postData = this._postDatas.ToString();
            try
            {
                using (var streamWriter = new StreamWriter(request.GetRequestStream()))
                {
                    streamWriter.Write(postData);
                }
            }
            catch (Exception ex)
            {
                LogConstant.logger.Print("[Post][Exception]" + ex.ToString());
            }
 
            LogConstant.logger.Print(string.Format("[Post][Error]准备向[{0}]发送错误消息: {1}", url, postData));
            string resContent = "";
            try
            {
                HttpWebResponse response = request.GetResponse() as HttpWebResponse;
                using (Stream resStream = response.GetResponseStream())
                {
                    using (StreamReader streamReader = new StreamReader(resStream, Encoding.UTF8))
                    {
                        resContent = streamReader.ReadToEnd().ToString();
                    }
                }
 
                LogConstant.logger.Print(string.Format("[Post][Error]错误消息发送成功,从[{0}]收到返回消息: {1}", url, resContent));
                return resContent;
            }
            catch(Exception ex)
            {
                LogConstant.logger.Print("[Post][Error]错误消息发送失败,未收到返回消息:" + ex.Message);
                throw ex;
            }
        }
 
        public static void Send(string data)
        {
            BiosenErrorRequestClient client = new BiosenErrorRequestClient();
            client.Payload = data;
            string t_response = client.Post(BiosenErrorRequestClient.Uri + "?name=" + client.m_strName);
            return;
        }
 
        public string Payload
        {
            set
            {
                this.m_strPayload = value;
                this.m_strName = XImaging.Automation.Library.HxDriverLib.Encrypt.md5(this.m_strPayload + SO_DELIMITER);
                this._postDatas = JObject.Parse(this.m_strPayload);
            }
            get
            {
                return m_strPayload;
            }
        }
    }
 
    public class UploadParameterType
    {
        public UploadParameterType()
        {
            Encoding = Encoding.UTF8;
            PostParameters = new Dictionary<string, string>();
        }
        /// <summary>
        /// 上传地址
        /// </summary>
        public string Url { get; set; }
        /// <summary>
        /// 文件名称key
        /// </summary>
        public string FileName { get; set; }
        /// <summary>
        /// 编码格式
        /// </summary>
        public Encoding Encoding { get; set; }
        /// <summary>
        /// 上传文件的流
        /// </summary>
        public Stream UploadStream { get; set; }
        /// <summary>
        /// 上传文件 携带的参数集合
        /// </summary>
        public IDictionary<string, string> PostParameters { get; set; }
    }
 
    public  class BiosenFileRequestClient : HttpRequestClient
    {
        public static string Uri { set; get; }
        
        private UploadParameterType parameters;
        public static void Init()
        {
            PostServerSection section = ConfigurationManager.GetSection("fileServer") as PostServerSection;
            BiosenFileRequestClient.Uri = section.Server.URI;
        }
 
        public override string Post(string url)
        {
            if (string.IsNullOrWhiteSpace(url))
                throw new ArgumentNullException(nameof(url));
 
            string boundary = DateTime.Now.Ticks.ToString("x");          // 边界符
            byte[] beginBoundaryBytes = Encoding.UTF8.GetBytes("--" + boundary + "\r\n");
            byte[] endBoundaryBytes = Encoding.UTF8.GetBytes("\r\n--" + boundary + "--\r\n");
            byte[] newLineBytes = Encoding.UTF8.GetBytes("\r\n");
 
            MemoryStream memoryStream = new MemoryStream();
            if (this.parameters.PostParameters != null && parameters.PostParameters.Count > 0)
            {
                foreach (KeyValuePair<string, string> keyValuePair in parameters.PostParameters)
                {
                    string parameterHeaderTemplate = string.Format("Content-Disposition: form-data; name=\"{0}\"\r\n\r\n{1}\r\n", keyValuePair.Key, keyValuePair.Value);
                    byte[] parameterHeaderBytes = parameters.Encoding.GetBytes(parameterHeaderTemplate);
 
                    memoryStream.Write(beginBoundaryBytes, 0, beginBoundaryBytes.Length);
                    memoryStream.Write(parameterHeaderBytes, 0, parameterHeaderBytes.Length);
                }
            }
 
            const string filePartHeaderTemplate = "Content-Disposition: form-data; name=\"{0}\"; filename=\"{1}\"\r\n" +
            "Content-Type: application/octet-stream\r\n\r\n";
            int i = 0;
 
            if (this.parameters.FileName != null)
            {
                FileInfo fileInfo = new FileInfo(this.parameters.FileName);
                string fileName = fileInfo.Name;
 
                string fileHeaderItem = string.Format(filePartHeaderTemplate, "files", fileName);
                byte[] fileHeaderItemBytes = Encoding.UTF8.GetBytes(fileHeaderItem);
 
                if (i > 0)
                {
                    memoryStream.Write(newLineBytes, 0, newLineBytes.Length);
                }
                memoryStream.Write(beginBoundaryBytes, 0, beginBoundaryBytes.Length);
                memoryStream.Write(fileHeaderItemBytes, 0, fileHeaderItemBytes.Length);
 
                int bytesRead;
                byte[] buffer = new byte[1024];
 
                FileStream fileStream = new FileStream(this.parameters.FileName, FileMode.Open, FileAccess.Read);
                while ((bytesRead = fileStream.Read(buffer, 0, buffer.Length)) != 0)
                {
                    memoryStream.Write(buffer, 0, bytesRead);        // 2.3 将文件流写入FormData项中
                }
 
                i++;
            }
 
            memoryStream.Write(endBoundaryBytes, 0, endBoundaryBytes.Length);
 
            HttpWebRequest request = null;
            if (url.ToLowerInvariant().StartsWith("https"))
            {
                request = WebRequest.Create(url) as HttpWebRequest;
                ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback((s, c, ch, ss) => { return true; });
                request.ProtocolVersion = HttpVersion.Version11;
                ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls;
                request.KeepAlive = true;
                ServicePointManager.CheckCertificateRevocationList = true; ServicePointManager.DefaultConnectionLimit = 100;
                ServicePointManager.Expect100Continue = false;
            }
            else
            {
                request = WebRequest.Create(url) as HttpWebRequest;
            }
 
            request.Timeout = 10000;
            request.Method = "POST";
            request.ContentType = string.Format("multipart/form-data; boundary={0}", boundary);
            request.UserAgent = this.UserAgent;
            request.Accept = this.Accept;
            request.Referer = this.Referer;
            request.ContentLength = memoryStream.Length;
            request.CookieContainer = this.CookieContainer;
 
            memoryStream.Position = 0;
            byte[] tempBuffer = new byte[memoryStream.Length];
            memoryStream.Read(tempBuffer, 0, tempBuffer.Length);
            memoryStream.Close();
 
            using (var streamWriter = request.GetRequestStream())
            {
                streamWriter.Write(tempBuffer, 0, tempBuffer.Length);
            }
 
            string resContent = "";
            HttpWebResponse response = request.GetResponse() as HttpWebResponse;
            using (Stream resStream = response.GetResponseStream())
            {
                using (StreamReader streamReader = new StreamReader(resStream, Encoding.UTF8))
                {
                    resContent = streamReader.ReadToEnd().ToString();
                }
            }
 
            return resContent;
        }
 
        public static string Send(UploadParameterType parameters)
        {
            BiosenFileRequestClient client = new BiosenFileRequestClient();
            client.parameters = parameters;
            LogConstant.logger.Print(string.Format("[Post][File]准备上传文件[{0}]到数据服务器", parameters.FileName));
            string t_response = client.Post(BiosenFileRequestClient.Uri);
            JObject res = JObject.Parse(t_response);
            if (res["status"].ToString().Equals("0"))
            {
                string url = res["data"].ToString();
                LogConstant.logger.Print(string.Format("[Post][File]文件上传到数据服务器的保存地址:[{0}]", t_response));
                return url;
            }
            else
            {
                LogConstant.logger.Print(string.Format("[Post][File]文件上传数据服务器失败:{0}", res["message"].ToString()));
                throw new Exception(res["message"].ToString());
            }
        }
    }
 
    internal sealed class BiosenBatchFilesRequestClient : HttpRequestClient
    {
        public static string Uri { set; get; }
 
        private UploadParameterType parameters;
        public static void Init()
        {
            PostServerSection section = ConfigurationManager.GetSection("fileServer") as PostServerSection;
            BiosenBatchFilesRequestClient.Uri = section.Server.URI;
        }
 
        public override string Post(string url)
        {
            if (string.IsNullOrWhiteSpace(url))
                throw new ArgumentNullException(nameof(url));
 
            string boundary = DateTime.Now.Ticks.ToString("x");          // 边界符
            byte[] beginBoundaryBytes = Encoding.UTF8.GetBytes("--" + boundary + "\r\n");
            byte[] endBoundaryBytes = Encoding.UTF8.GetBytes("\r\n--" + boundary + "--\r\n");
            byte[] newLineBytes = Encoding.UTF8.GetBytes("\r\n");
 
            MemoryStream memoryStream = new MemoryStream();
            if (this.parameters.PostParameters != null && parameters.PostParameters.Count > 0)
            {
                foreach (KeyValuePair<string, string> keyValuePair in parameters.PostParameters)
                {
                    string parameterHeaderTemplate = string.Format("Content-Disposition: form-data; name=\"{0}\"\r\n\r\n{1}\r\n", keyValuePair.Key, keyValuePair.Value);
                    byte[] parameterHeaderBytes = parameters.Encoding.GetBytes(parameterHeaderTemplate);
 
                    memoryStream.Write(beginBoundaryBytes, 0, beginBoundaryBytes.Length);
                    memoryStream.Write(parameterHeaderBytes, 0, parameterHeaderBytes.Length);
                }
            }
 
            const string filePartHeaderTemplate = "Content-Disposition: form-data; name=\"{0}\"; filename=\"{1}\"\r\n" +
            "Content-Type: application/octet-stream\r\n\r\n";
            int i = 0;
 
            if (this.parameters.FileName != null)
            {
                FileInfo fileInfo = new FileInfo(this.parameters.FileName);
                string fileName = fileInfo.Name;
 
                string fileHeaderItem = string.Format(filePartHeaderTemplate, "files", fileName);
                byte[] fileHeaderItemBytes = Encoding.UTF8.GetBytes(fileHeaderItem);
 
                if (i > 0)
                {
                    memoryStream.Write(newLineBytes, 0, newLineBytes.Length);
                }
                memoryStream.Write(beginBoundaryBytes, 0, beginBoundaryBytes.Length);
                memoryStream.Write(fileHeaderItemBytes, 0, fileHeaderItemBytes.Length);
 
                int bytesRead;
                byte[] buffer = new byte[1024];
 
                FileStream fileStream = new FileStream(this.parameters.FileName, FileMode.Open, FileAccess.Read);
                while ((bytesRead = fileStream.Read(buffer, 0, buffer.Length)) != 0)
                {
                    memoryStream.Write(buffer, 0, bytesRead);        // 2.3 将文件流写入FormData项中
                }
 
                i++;
            }
 
            memoryStream.Write(endBoundaryBytes, 0, endBoundaryBytes.Length);
 
            HttpWebRequest request = null;
            if (url.ToLowerInvariant().StartsWith("https"))
            {
                request = WebRequest.Create(url) as HttpWebRequest;
                ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback((s, c, ch, ss) => { return true; });
                request.ProtocolVersion = HttpVersion.Version11;
                ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls;
                request.KeepAlive = true;
                ServicePointManager.CheckCertificateRevocationList = true; ServicePointManager.DefaultConnectionLimit = 100;
                ServicePointManager.Expect100Continue = false;
            }
            else
            {
                request = WebRequest.Create(url) as HttpWebRequest;
            }
 
 
            request.Method = "POST";
            request.ContentType = string.Format("multipart/form-data; boundary={0}", boundary);
            request.UserAgent = this.UserAgent;
            request.Accept = this.Accept;
            request.Referer = this.Referer;
            request.ContentLength = memoryStream.Length;
            request.CookieContainer = this.CookieContainer;
 
            memoryStream.Position = 0;
            byte[] tempBuffer = new byte[memoryStream.Length];
            memoryStream.Read(tempBuffer, 0, tempBuffer.Length);
            memoryStream.Close();
 
            using (var streamWriter = request.GetRequestStream())
            {
                streamWriter.Write(tempBuffer, 0, tempBuffer.Length);
            }
 
            string resContent = "";
            HttpWebResponse response = request.GetResponse() as HttpWebResponse;
            using (Stream resStream = response.GetResponseStream())
            {
                using (StreamReader streamReader = new StreamReader(resStream, Encoding.UTF8))
                {
                    resContent = streamReader.ReadToEnd().ToString();
                }
            }
            return resContent;
        }
 
        public static string Send(UploadParameterType parameters)
        {
 
            BiosenBatchFilesRequestClient client = new BiosenBatchFilesRequestClient();
            client.parameters = parameters;
            LogConstant.logger.Print(string.Format("[Post][File]准备上传文件[{0}]到数据服务器", parameters.FileName));
            string t_response = client.Post(BiosenFileRequestClient.Uri);
            JObject res = JObject.Parse(t_response);
            if (res["status"].ToString().Equals("0"))
            {
                string url = res["data"].ToString();
                LogConstant.logger.Print(string.Format("[Post][File]文件上传到数据服务器的保存地址:[{0}]", t_response));
                return url;
            }
            else
            {
                LogConstant.logger.Print(string.Format("[Post][File]文件上传数据服务器失败:{0}", res["message"].ToString()));
                throw new Exception(res["message"].ToString());
            }
        }
    }
}