This commit is contained in:
2025-08-30 13:53:59 +08:00
parent cb4c3b2935
commit ed47497d8c
17 changed files with 116 additions and 18 deletions

View File

@@ -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;