11
This commit is contained in:
@@ -12,6 +12,7 @@ using System.Threading.Tasks;
|
||||
using System.Web;
|
||||
using MyCode.Project.Infrastructure.Common;
|
||||
using MyCode.Project.Infrastructure.Exceptions;
|
||||
using Org.BouncyCastle.Asn1.Ocsp;
|
||||
|
||||
namespace MyCode.Project.Infrastructure.WebPost
|
||||
{
|
||||
@@ -531,12 +532,18 @@ namespace MyCode.Project.Infrastructure.WebPost
|
||||
/// <returns></returns>
|
||||
public string DoPostJson(string url, string jsonData)
|
||||
{
|
||||
// 在应用程序启动时设置(如Main方法或Application_Start)
|
||||
System.Net.ServicePointManager.SecurityProtocol =
|
||||
SecurityProtocolType.Tls12;
|
||||
string result = "";
|
||||
|
||||
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
|
||||
req.Method = "POST";
|
||||
req.Timeout = 60*1000;//设置请求超时时间,单位为毫秒
|
||||
req.ContentType = "application/json";
|
||||
req.ProtocolVersion = HttpVersion.Version11;
|
||||
req.ServicePoint.Expect100Continue = true;
|
||||
//req.ServicePoint.SecurityProtocol = SecurityProtocolType.Tls12;
|
||||
|
||||
byte[] data = Encoding.UTF8.GetBytes(jsonData);
|
||||
req.ContentLength = data.Length;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user