c# - wcf router doesn't expose metadata -


there 30 wcf services , use wcf router distribute requests client. wcf services hosted windows service. when put client , service in same computer, client , service can contact each other. however, when in different machines, client can't contact service. used wcftestclient test service , can't add service, or can't add service if use added client project test it. individual service use net.pipe , router uses net.tcp if service in different machine client. have been working on couple of weeks , problem still there. can point out possibly wrong it? lot!

we have setting configuration file end users input name of service server address. port number in setting file also.

    if (!this._issinglecomputer)         {             // add protocol conversion router             uri routerbaseaddress = new uri(publicbaseaddress, "router");             _routingsvchost = new servicehost(typeof(routingservice), routerbaseaddress);             _routingsvchostmex = new servicehost(typeof (routingservice), new uri(routerbaseaddress, "mex"));              // add endpoint router use receive service requests             // use iduplexsessionrouter support variety of one-way , two-way calls             _routingsvchost.addserviceendpoint(typeof(iduplexsessionrouter), new nettcpbinding(securitymode.none), "");             _routingsvchostmex.addserviceendpoint(typeof(iduplexsessionrouter), metadataexchangebindings.createmextcpbinding(), "mex");              // add routing config             routingconfiguration rc = new routingconfiguration();              // loop on hosted interfaces , add entries routing table             foreach (iwcfservicelibrary sl in wcfservicelibraries)             {                 foreach (iwcfserviceconfig config in sl.wcfserviceconfigs)                 {                     string routedservice = config.wcfservice.serviceclassname.split('.').last();                     var contract = contractdescription.getcontract(typeof(isimplexdatagramrouter));                     var client = new serviceendpoint(contract, new netnamedpipebinding(netnamedpipesecuritymode.none), new endpointaddress("net.pipe://localhost/" + routedservice));                     var ea = new endpointaddress(routerbaseaddress.absoluteuri.tostring() + "/" + routedservice);                     rc.filtertable.add(new endpointaddressmessagefilter(ea, false), new list<serviceendpoint>() { client });                 }             }              _routingsvchost.description.behaviors.add(new routingbehavior(rc));             _routingsvchostmex.description.behaviors.add(new routingbehavior(rc));              _routingsvchost.open();             _routingsvchostmex.open();               loggingservice.logger.info(string.format("it routing services @ {0}", routerbaseaddress.absoluteuri));         } 

you can add service behavior , turn on httpgetenabled property.

servicemetadatabehavior b = new servicemetadatabehavior { httpgetenabled = true }; b.httpgeturl = mymetadatauri; routingsvchost.description.behaviors.add(b); 

Comments

Popular posts from this blog

php - Submit Form Data without Reloading page -

linux - Rails running on virtual machine in Windows -

php - $params->set Array between square bracket -