问题
I am able to customize the ServiceHost on a WcfCommunicationListener from this post that I submitted the other day. However, I'm now getting some very strange behavior from Service Fabric when hosting multiple WCF endpoints on a stateless service.
I am assigning multiple listeners to the ServiceInstanceListner array:
I am ensuring that they each have a unique name, as well as unique contracts, and custom endpoints and paths.
When deployed to ServiceFabric they both show up as expected as enpoints on that service:
And when I fire up my WcfTestClient and call one of the endpoints I get back the methods as expected:
However once I call the other service the strangeness begins, I can see both contracts being exposed on the same endpoint:
Calling the initial endpoint a second time yields similar results:
If I add service references from a Visual Studio project the same issue occurs. I've also pushed this to a cluster on Azure to make sure it wasn't a local issue.
I've combed through my code hundreds of times to ensure that neither listener/servicehost shares any contracts, endpoints or other implementation details with the other so I am at a loss as to how to keep these isolated.
I have very similar code that I am migrating from a Cloud Services project and have never seen this before when working in that platform. Any ideas on how to ensure endpoint isolation? I tried using separate ports to no avail and am at a loss.
I did notice in the config file generated by WcfTestClient that I have both netTcpBindings represented on each service - but I cannot tell if this is a symptom or a cause:
回答1:
I tried to repro this issue but it worked as expected. I have uploaded the sample here https://github.com/suchiagicha/Samples
You could then tell us if you are doing anything different.
来源:https://stackoverflow.com/questions/42845939/wcf-endpoints-exposing-multiple-contracts-in-service-fabric