7我有一个使用基本身份验证的页面。我试图验证它,但我不断收到运行时错误,我不知道如何弄清楚如何调试它。
在我的服务器上,该页面是SSL。我尝试将rest客户端创建到同一域上的另一个SSL页面。这是一个问题吗?
var nclient = new RestClient();
nclient.BaseUrl = "https://www.blank.com/";
nclient.Authenticator = new HttpBasicAuthenticator(id, password);
var nrequest = new RestRequest();
nrequest.Resource = "login.html";
nrequest.AddHeader("Accept", "*/*");
IRestResponse response;
response = nclient.Execute(nrequest);
if (response.ErrorException != null)
{
throw response.ErrorException;
}
错误:
[SocketException (0x274c): A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond xxx.xxx.xxx.190:443]
System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress) +251
System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Int32 timeout, Exception& exception) +279
[NullReferenceException: Object reference not set to an instance of an object.]
WebApplication3._default.Button1_Click(Object sender, EventArgs e) in C:\Users\\default.aspx.cs:40
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +118
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +112
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5563
答案 0 :(得分:0)
好的我明白了。原来我必须将页面发布到不同的服务器。它现在正在工作。