System.Net.Sockets.SocketException: 由于目标机器积极拒绝,无法连接。的解决方案 ??
由于目标机器积极拒绝,无法连接。说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。
异常详细信息: System.Net.Sockets.SocketException: 由于目标机器积极拒绝,无法连接。
源错误:
行 32: RemoteObject.IMyObject mo = (RemoteObject.IMyObject)Activator.GetObject(typeof(RemoteObject.IMyObject), ConfigurationManager.AppSettings["TCPChannel"]);
行 33: Response.Write("TCP信道<br/>");
行 34: Response.Write(string.Format("记录数:{0}条<br/>", mo.GetData().Length));
行 35: Response.Write(string.Format("花费时间:{0}毫秒<br/>", sw.ElapsedMilliseconds));
行 36: }
堆栈跟踪:
[SocketException (0x274d): 由于目标机器积极拒绝,无法连接。]
System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) +1779954
System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) +826
RemoteObject.IMyObject.GetData() +0
RemotingTest.btn_TcpChannel_Click(Object sender, EventArgs e) in h:\ASP.NET2\Chapter23\TestWeb\RemotingTest.aspx.cs:34
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +105
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +107
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5102
以下是web中配置的路径
<add key="HTTPChannel" value="http://localhost:1026/myObject"/>
<add key="TCPChannel" value="tcp://localhost:2141/myObject"/>
<add key="IPCChannel" value="ipc://testPipe/myObject"/>
<add key="TestWS.Service" value="http://localhost/kk/Service.asmx"/>
好像是不是本机这些端口号并没开启,如何才能正常访问路径所指的文件代码呢?
--------------------编程问答-------------------- 你可以把localhost改为相应的IP地址试试,端口号也不要指定了 --------------------编程问答-------------------- 可能这个是无法在服务器端调试的,你从外部访问应该是没有问题的吧
把端口去掉应该就可以了
补充:.NET技术 , Web Services