SocketException 10061 不能做任何连接,因为目标机器积极地拒绝它。——各位兄弟帮忙看看,先谢了!
开发环境:
Win2k Server sp4 + VS2005
使用状况:
MS 对外提供一个 MapPoint 的 WebService,可是俺在执行示例程序调用时就遇到这个异常。
上网也查了,有的说是端口问题,俺把瑞星防火墙关了照样出这个错误!
问题1:不清楚应该放行哪个端口?该如何查看?
还有的说是没有启动 ScktSrvr.exe!
问题2:从哪里可以找到这个东东,如何启动?
问题3:如果没有安装,应该如何安装 ScktSrvr.exe?
问题4:是否还存在其他问题?
请兄弟们帮忙看看,多谢了! 问题一解决马上散分结贴!
异常信息:
[SocketException (0x274d): 不能做任何连接,因为目标机器积极地拒绝它。]
System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress) +200
System.Net.Sockets.Socket.InternalConnect(EndPoint remoteEP) +60
System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Int32 timeout, Exception& exception) +579
[WebException: Unable to connect to the remote server]
System.Net.HttpWebRequest.GetRequestStream() +734
System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters) +176
MapPointService.FindServiceSoap.Find(FindSpecification specification) in c:\WINNT\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\virtualearthexperience\5298d8ee\19425f8b\App_WebReferences.t2xmjnxf.0.cs:445
CoreFunctionality_Find.ButtonFind_Click(Object sender, EventArgs e) in e:\Ifmsoft.Projects.Code\VS2005.VirtualEarthExperiment\VirtualEarthExperience\CoreFunctionality\Find.aspx.cs:60
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +96
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +116
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +31
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +32
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +72
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3837
[解决办法]
webservice一般是用web端口即80端口
查看命令
netstat /an
[解决办法]
帮顶,关注下.记得解决说下
[解决办法]
windows防火墙关了没?
[解决办法]
那是服务端那边拒绝访问,又不是你的程序有问题,除非你弄错IP地址或端口号!
[解决办法]
参考:
System.Net.WebProxy proxy = new System.Net.WebProxy(host,port);
NetworkCredential myCred = new NetworkCredential(username,password);
proxy.Credentials = myCred;
System.Net.GlobalProxySelection.Select = proxy;
------解决方案--------------------
参考:
System.Net.WebProxy proxy = new System.Net.WebProxy(host,port);
NetworkCredential myCred = new NetworkCredential(username,password);
proxy.Credentials = myCred;
System.Net.GlobalProxySelection.Select = proxy;