c# - Geting Error "No connection could be made because the target machine actively refused it" -
i creating smart device application client in visual studio 2008. have create web service stock data actual database , save in windows ce device compact database on button click event of smart device application. here code:
private void btngetdata_click(object sender, eventargs e) { serviceagent.inventorysev ws = new invetorydevice.serviceagent.inventorysev(); asynccallback cb = new asynccallback(servicecallback); ws.begingetinventorydata(cb, ws); } private void servicecallback(iasyncresult ar) { serviceagent.inventorysev ws = (serviceagent.inventorysev)ar.asyncstate; datatable dt = ws.endgetinventorydata(ar); }
i geting error:
datatable dt = ws.endgetinventorydata(ar);
error:
system.net.webexception unhandled message="unable connect remote server" stacktrace: @ system.net.httpwebrequest.finishgetresponse() @ system.net.httpwebrequest.getresponse() @ system.web.services.protocols.webclientprotocol.getwebresponse(webrequest request) @ system.web.services.protocols.httpwebclientprotocol.getwebresponse(webrequest request) @ system.web.services.protocols.soaphttpclientprotocol.doinvoke(string methodname, object[] parameters, webclientasyncresult asyncresult) @ system.web.services.protocols.soaphttpclientprotocol.doasyncinvoke(object asyncresultasobject) @ system.threading.threadpool.workitem.dowork(object o) @ system.threading.timer.ring() innerexception: system.net.sockets.socketexception message="no connection made because target machine actively refused it" errorcode=10061 nativeerrorcode=10061 stacktrace: @ system.net.sockets.socket.connectnocheck(endpoint remoteep) @ system.net.sockets.socket.connect(endpoint remoteep) @ system.net.connection.doconnect(ipendpoint ep) @ system.net.connection.connect(object ignored) @ system.threading.threadpool.workitem.dowork(object o) @ system.threading.timer.ring()
your question seems duplication. regardless, problem not in code, connection database.
quoted no connection made because target machine actively refused 127.0.0.1:3446
"actively refused it" means host sent reset instead of ack when tried connect. therefore not problem in code. either there firewall blocking connection or process hosting service not listening on port, may because not running @ or because listening on different port.
once start process hosting service try netstat -anb (requires admin privileges) verify running , listening on expected port.
Comments
Post a Comment