由于我的网站使用ssl证书,因此我无法再从服务器访问xml文件。请帮助我。
我从ZeroSSL页面中有4个文件: account-key.txt; (RSA私钥) domain-csr.txt; (CRT)(CABUNDLE)2OmkvG1CfXtJ-sYpp5mV0 ......; (文件 无扩展名)qGGRddmOl62soMPdlCBeamnR ......; (文件不带 扩展名)
网址现在以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;
}
错误InnerException-> stacktrace:
en System.Net.Security.SslState.StartReadFrame(Byte [] buffer,Int32 readBytes,AsyncProtocolRequest asyncRequest) zh-cn System.Net.Security.SslState.StartReceiveBlob(字节[]缓冲区,AsyncProtocolRequest asyncRequest) zh-cn System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken消息,AsyncProtocolRequest asyncRequest) zh-cn System.Net.Security.SslState.ForceAuthentication(布尔型receiveFirst,字节[]缓冲区,AsyncProtocolRequest asyncRequest) zh-cn System.Net.Security.SslState.ProcessAuthentication(LazyAsyncResult lazyResult) zh-cn System.Threading.ExecutionContext.RunInternal(ExecutionContext executeContext,ContextCallback回调,对象状态,布尔类型saveSyncCtx) zh-cn System.Threading.ExecutionContext.Run(ExecutionContext执行上下文,ContextCallback回调,对象状态,布尔值saveSyncCtx) zh-cn System.Threading.ExecutionContext.Run(ExecutionContext执行上下文,ContextCallback回调,对象状态) zh-cn System.Net.TlsStream.ProcessAuthentication(LazyAsyncResult结果) zh-cn System.Net.TlsStream.Write(Byte []缓冲区,Int32偏移量,Int32大小) zh-cn System.Net.ConnectStream.WriteHeaders(布尔异步)
答案 0 :(得分:0)
无需共享您的SSL证书信息。
我认为这可能是一个简单的解决方案
string currentVersion = GetWebPage("http://sofobot.com/version.xml"); // https!
您需要将协议更改为HTTPS而不是使用HTTP
答案 1 :(得分:0)
我找到了解决办法
我必须删除服务器上的.HTACCESS文件。该文件包含以下代码:
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
网址保存在“ http //”