c# - WCF TCP Shared Services Enable Service Fails to Start -
in short, when go start worker process service process, fails , returns:
the cs.connector.protean service on local computer started , stopped. services stop automatically if not in use other services or programs
i remove attribute portsharingenabled="true" service model in config file , worker process service starts , executes expected. add attribute config , worker process services won't start again. have include service model config @ bottom of post.
the net.tcp sharing service running, should intercepting incoming net.tcp connection.
i have read msdn article, must missing somewhere.
could doe mex end point not using port sharing binding? tried adding binding mex end point, still no joy. :.(
help!
<system.servicemodel> <bindings> <nettcpbinding> <binding name="tcpsecure" portsharingenabled="true"> <security mode="message" /> </binding> </nettcpbinding> </bindings> <services> <service name="protean.connector.proteanconnector"> <endpoint address="" binding="nettcpbinding" bindingconfiguration="tcpsecure" contract="protean.connector.iproteanconnector"></endpoint> <endpoint address="mex" binding="mextcpbinding" contract="imetadataexchange" /> <host> <baseaddresses> <add baseaddress="net.tcp://10.1.2.124:60000/proteanconnector" /> </baseaddresses> </host> </service> </services> <behaviors> <servicebehaviors> <behavior name=""> <servicemetadata httpgetenabled="false" /> <servicedebug includeexceptiondetailinfaults="false" /> </behavior> </servicebehaviors> </behaviors> </system.servicemodel>
update!
- i started off working service , confirmed test.
- i added attribute port sharing , service failed start.
- i removed mex end point , service ran successfully. application had established connection able use service successfully.
- i added mex in reference binding had port sharing enabled , service fail start.
i need mex make service discoverable ide visual studios.
i suppose question is, how end point, metadata exchange, work along port sharing attribute?
update 2
this forum tells me change mex binding mextcpbinding nettcpbinging. did , service ran, unable discover service in ide.
is correct solution path? journey continues.
i'm starting think deeper dig more stumble upon government conspiracy. #humourindarktimes #strangerthings ;)
solution
var type = typeof(loggingmanager); using (var host = new servicehost(type)) { /* * work-around conflict between global port sharing , local port sharing * caused net.tcp sharing serivces , default port exclusivity (hogging) of metadata exchange binding. */ var mexbinding = new custombinding(metadataexchangebindings.createmextcpbinding()); mexbinding.elements.find<tcptransportbindingelement>().portsharingenabled = true; host.addserviceendpoint(typeof(imetadataexchange), mexbinding, "mex"); host.open(); console.writeline("service started. press [enter] exit."); console.readline(); host.close(); }
description of solution
i read number of articles suggests solution through swapping binding mextcpbinding nettcpbinding, found did not work in instance.
the above solution gets mextcpbinding , adds attribute portsharingenabled = true. used in creating new endpoint code-matically , passed service host. finally, have removed meta-exchange end point config and, hey-presto, worked.
useful links
wiki
Comments
Post a Comment