c# - How do I connect to a Azure Worker Role with tcp endpoint? Tech help needed with Tcp and Azure -
i created worker role in visual studio , deployed azure. azure shows running on staging.
on cloud services screen there url service, doesn't seem when ping or navigate there. get:
this webpage not available
err_name_not_resolved
i wrote following code try , access service through tcpclient:
string ip = "http://mysite.cloudapp.net"; int port = 10; tcpclient client = new tcpclient(); try { client.connect(ip, port); // line throws error. if (client.connected) { client.close(); } } catch (exception ex) { trace.warn(ex.message); }
on client.connect(ip, port) there error says message = "the requested name valid, no data of requested type found"
my workerrole has following run method (copied online tutorial believe).
public override void run() { trace.traceinformation("wr running"); tcplistener listener = null; try { listener = new tcplistener( roleenvironment.currentroleinstance.instanceendpoints["myendpoint"].ipendpoint); listener.exclusiveaddressuse = false; listener.start(); } catch (socketexception) { trace.write("echo server not start.", "error"); return; } while (true) { iasyncresult result = listener.beginaccepttcpclient(handleasyncconnection, listener); connectionwaithandle.waitone(); } }
finally in csdef endpoint appears so:
<inputendpoint name="myendpoint" protocol="tcp" port="10" localport="10" />
i'd connection talking , forth.
have tried removing "http:" value of "ip" variable? want ip address points to, aren't bound http protocol.
Comments
Post a Comment