HTTP Web请求异常-无法连接到远程服务器

时间:2018-09-20 19:40:31

标签: .net iis xmlhttprequest windows-server-2012-r2

我编写了一个小型的.NET应用程序,该应用程序通过http连接到远程主机以从中检索数据。它在我的本地计算机上运行良好,但是当我将其发布到生产服务器时,该应用程序似乎无法与远程主机成功建立连接。我不知道我在这里缺少什么-任何帮助将不胜感激。

这是来自服务器的.net跟踪日志的一部分:

System.Net Verbose: 0 : [4972] Entering WebRequest::Create(https://tls1ca.imodulesapi.com/ws/21/GeneralQuery.asmx)
System.Net Verbose: 0 : [4972] Entering HttpWebRequest#39857290::HttpWebRequest(https://tls1ca.imodulesapi.com/ws/21/GeneralQuery.asmx#-1022471907)
System.Net Information: 0 : [4972] RAS supported: True
System.Net Verbose: 0 : [4972] Exiting HttpWebRequest#39857290::HttpWebRequest() 
System.Net Verbose: 0 : [4972] Exiting WebRequest::Create() 	-> HttpWebRequest#39857290
System.Net Verbose: 0 : [4972] Entering HttpWebRequest#39857290::GetRequestStream()
System.Net Verbose: 0 : [4972] Entering ServicePoint#56908170::ServicePoint(tls1ca.imodulesapi.com:443)
System.Net Information: 0 : [4972] Associating HttpWebRequest#39857290 with ServicePoint#56908170
System.Net Information: 0 : [4972] Associating Connection#13418106 with HttpWebRequest#39857290
System.Net Verbose: 0 : [4856] Entering WebRequest::Create(https://tls1ca.imodulesapi.com/ws/21/GeneralQuery.asmx)
System.Net Verbose: 0 : [4856] Entering HttpWebRequest#60207123::HttpWebRequest(https://tls1ca.imodulesapi.com/ws/21/GeneralQuery.asmx#-1022471907)
System.Net Verbose: 0 : [4856] Exiting HttpWebRequest#60207123::HttpWebRequest() 
System.Net Verbose: 0 : [4856] Exiting WebRequest::Create() 	-> HttpWebRequest#60207123
System.Net Verbose: 0 : [4856] Entering HttpWebRequest#60207123::GetRequestStream()
System.Net Information: 0 : [4856] Associating HttpWebRequest#60207123 with ServicePoint#56908170
System.Net Information: 0 : [4856] Associating Connection#56833753 with HttpWebRequest#60207123
System.Net Verbose: 0 : [4860] Entering WebRequest::Create(https://tls1ca.imodulesapi.com/ws/21/GeneralQuery.asmx)
System.Net Verbose: 0 : [4860] Entering HttpWebRequest#28387590::HttpWebRequest(https://tls1ca.imodulesapi.com/ws/21/GeneralQuery.asmx#-1022471907)
System.Net Verbose: 0 : [4860] Exiting HttpWebRequest#28387590::HttpWebRequest() 
System.Net Verbose: 0 : [4860] Exiting WebRequest::Create() 	-> HttpWebRequest#28387590
System.Net Verbose: 0 : [4860] Entering HttpWebRequest#28387590::GetRequestStream()
System.Net Information: 0 : [4860] Associating HttpWebRequest#28387590 with ServicePoint#56908170
System.Net Information: 0 : [4860] Associating Connection#17693431 with HttpWebRequest#28387590
System.Net Error: 0 : [4972] Exception in HttpWebRequest#39857290:: - Unable to connect to the remote server.

这是浏览器的例外情况:

<!-- 
[SocketException]: 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 104.18.230.150:443
   at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
   at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Exception& exception)
[WebException]: Unable to connect to the remote server
   at System.Net.HttpWebRequest.GetRequestStream(TransportContext& context)
   at System.Net.HttpWebRequest.GetRequestStream()
   at IMWSInterface.Models.APIAccess.AddEnvelopToRequest(XmlDocument soapEnvelop, HttpWebRequest request)
   at IMWSInterface.Models.APIAccess.GetMemberId(String constitID)
   at IMWSInterface.Controllers.HomeController.Index()
   at lambda_method(Closure , ControllerBase , Object[] )
   at System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters)
   at System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters)
   at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters)
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.<BeginInvokeSynchronousActionMethod>b__39(IAsyncResult asyncResult, ActionInvocation innerInvokeState)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`2.CallEndDelegate(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResultBase`1.End()
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3d()
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.AsyncInvocationWithFilters.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f()
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass33.<BeginInvokeActionMethodWithFilters>b__32(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`1.CallEndDelegate(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResultBase`1.End()
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass21.<>c__DisplayClass2b.<BeginInvokeAction>b__1c()
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.<>c__DisplayClass21.<BeginInvokeAction>b__1e(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResult`1.CallEndDelegate(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResultBase`1.End()
   at System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult)
   at System.Web.Mvc.Controller.<BeginExecuteCore>b__1d(IAsyncResult asyncResult, ExecuteCoreState innerState)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResultBase`1.End()
   at System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult)
   at System.Web.Mvc.Controller.<BeginExecute>b__15(IAsyncResult asyncResult, Controller controller)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResultBase`1.End()
   at System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult)
   at System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute(IAsyncResult asyncResult)
   at System.Web.Mvc.MvcHandler.<BeginProcessRequest>b__5(IAsyncResult asyncResult, ProcessRequestState innerState)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult)
   at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncResultBase`1.End()
   at System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult)
   at System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result)
   at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
   at System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step)
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
-->

0 个答案:

没有答案