WCF - Why would you want to create multiple endpoints for a service?
I am very new at WCF. I'm creating a prototype app to learn WCF. I have the following code to create a service host, which works fine:
servic开发者_开发知识库eHost = new ServiceHost(typeof(ServiceMethods), new Uri("http://localhost:8888/MyService"));
serviceHost.AddServiceEndpoint(typeof(IB.Entities.ServiceInterfaces.ILocation), WcfConfiguration.GenerateBinding(Enumerations.WcfBindingType.HTTP), "");
My question is this. Since it appears you can add multiple endpoints for a service host, under what circumstances/situations would you want to do this? What would be the advantage(s)?
Lets say your WCF service hosts the BLL (business rules, data validation, database connections, etc) and you have windows clients written in C#, for those is best to make a endpoint that uses the TCP binding (faster serialization, works only between .NET apps), then you have a website written in php or java, in order for this site to call your service you'll need a HTTP endpoint (exposed by SOAP - like a basic Web service).
- You may want to publish Metadata for other devs to develop against, so adding a MEX end point.
- You may want to support multiple protocols, e.g. NetTCP for .NET clients and WSHTTP for Java clients
- You may also want to add a basicHTTP endpoint for legacy support.
精彩评论