implementing routing into my wcf service -
i have clients upload files server using wcf service streaming. code on client (omitting details):
nettcpbinding binding = new nettcpbinding(); endpointaddress address = new endpointaddress("net.tcp://" + ipaddress + ":5000/datauploader"); channelfactory<idatauploader> channel = new channelfactory<idatauploader>(binding, address); idatauploader uploader = channel.createchannel(); try { uploader.upload(msg); consoletext.record("the file sent...\n"); } catch (communicationexception) { consoletext.record("the file not sent...\n" + "interrupted connection...\n"); } { uploadstream.close(); ((iclientchannel)uploader).close(); }
i want implement routing service between server , client, routing service this:
private static void configurerouterviacode(servicehost servicehost) { string clientaddress = "http://localhost:5000/datauploader"; string routeraddress = "http://localhost:5000/routerservice"; binding routerbinding = new wshttpbinding(); binding clientbinding = new wshttpbinding(); servicehost.addserviceendpoint(typeof(irequestreplyrouter), routerbinding, routeraddress); contractdescription contract = contractdescription.getcontract(typeof(irequestreplyrouter)); serviceendpoint client = new serviceendpoint(contract, clientbinding, new endpointaddress(clientaddress)); routingconfiguration rc = new routingconfiguration(); list<serviceendpoint> endpointlist = new list<serviceendpoint>(); endpointlist.add(client); rc.filtertable.add(new matchallmessagefilter(), endpointlist); servicehost.description.behaviors.add(new routingbehavior(rc)); }
it's confused how can connect client routing service first. approach?? thanks.
your approach correct. on client, change address pointing routing service, leaving other settings were. suggest study http://msdn.microsoft.com/en-us/library/ee517423.aspx or find demo routing implementations.
Comments
Post a Comment