gpt4 book ai didi

C# 使用 HTTPS 从 URL 读取 XML 文件。 (使用 godaddy 托管)(来自 ZerosSSL 的证书)

转载 作者:太空宇宙 更新时间:2023-11-03 14:29:16 25 4
gpt4 key购买 nike

由于我的站点使用 ssl 证书,我无法再从我的服务器访问 xml 文件。请帮助我。

I have 4 files from ZeroSSL page: account-key.txt; (RSA PRIVATE KEY) domain-csr.txt; (CRT) (CABUNDLE) 2OmkvG1CfXtJ-sYpp5mV0......; (File without extension) qGGRddmOl62soMPdlCBeamnR......; (File without extension)

url现在以https开头,我现在的代码是:

string currentVersion = GetWebPage("http://sofobot.com/version.xml");
XmlDocument VersionInfo = new XmlDocument();
VersionInfo.LoadXml(currentVersion);
.
.
public static string GetWebPage(string URL)
{
System.Net.HttpWebRequest Request = (HttpWebRequest)(WebRequest.Create(new Uri(URL)));
Request.Method = "GET";
Request.MaximumAutomaticRedirections = 4;
Request.MaximumResponseHeadersLength = 4;
Request.ContentLength = 0;
StreamReader ReadStream = null;
HttpWebResponse Response = null;
string ResponseText = string.Empty;
Response = (HttpWebResponse)(Request.GetResponse());
Stream ReceiveStream = Response.GetResponseStream();
ReadStream = new StreamReader(ReceiveStream, System.Text.Encoding.UTF8);
ResponseText = ReadStream.ReadToEnd();
Response.Close();
ReadStream.Close();
return ResponseText;
}

enter image description here错误 InnerException -> 堆栈跟踪:

zh-CN System.Net.Security.SslState.StartReadFrame(Byte[] 缓冲区,Int32 readBytes,AsyncProtocolRequest asyncRequest) zh System.Net.Security.SslState.StartReceiveBlob(字节 [] 缓冲区,AsyncProtocolRequest asyncRequest) zh System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken 消息,AsyncProtocolRequest asyncRequest) zh System.Net.Security.SslState.ForceAuthentication(Boolean receiveFirst, Byte[] buffer, AsyncProtocolRequest asyncRequest) zh System.Net.Security.SslState.ProcessAuthentication(LazyAsyncResult lazyResult) zh System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext,ContextCallback 回调,对象状态,Boolean preserveSyncCtx) zh System.Threading.ExecutionContext.Run(ExecutionContext executionContext,ContextCallback 回调,对象状态,Boolean preserveSyncCtx) zh System.Threading.ExecutionContext.Run(ExecutionContext executionContext,ContextCallback 回调,对象状态) zh System.Net.TlsStream.ProcessAuthentication(LazyAsyncResult 结果) zh System.Net.TlsStream.Write(字节 [] 缓冲区,Int32 偏移量,Int32 大小) zh System.Net.ConnectStream.WriteHeaders( bool 异步)

最佳答案

无需共享您的 SSL 证书信息。

我认为这可能是一个简单的解决方案

string currentVersion = GetWebPage("http://sofobot.com/version.xml"); // https!

您需要将协议(protocol)更改为 HTTPS 而不是使用 HTTP

关于C# 使用 HTTPS 从 URL 读取 XML 文件。 (使用 godaddy 托管)(来自 ZerosSSL 的证书),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54240435/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com