2
votes

I am new in WCF. I know that we have to write endpoint in config file at service end and as well as client end. suppose I have multiple endpoint like

<services>
      <service name="YourNamespace.YourService" behaviorConfiguration="Default">
        <endpoint name="Default" 
            address="http://YourServer/Services/MyService" 
            binding="basicHttpBinding" 
            contract="YourNamespace.IYourService"/>
        <endpoint name="TCP" 
            address="net.tcp://YourServer/ServicesTCP/MyService" 
            binding="netTcpBinding" 
            contract="YourNamespace.IYourService"/>

        <endpoint name="Dual" 
            address="http://YourServer/Services/MyService/Dual" 
            binding="wsDualHttpBinding" 
            clientBaseAddress="http://localhost:8001/client/"
            contract="YourNamespace.IYourDualService"/>

        <endpoint name="mex" 
            address=""
            binding="mexHttpBinding" 
            contract="IMetadataExchange"/>
      </service>
    </services>

we know that we can not create proxy at client side with endpoint address like

http://YourServer/Services/MyService/Dual or
net.tcp://YourServer/ServicesTCP/MyService

rather if we need to create proxy at client side then we need to provide mex endpoint address. so I just do not understand what is the use of endpoint address?

When we create proxy at client side and call service then we just do not understand our proxy is using what endpoint address to connect to service?

That is why I just want to know how endpoint address come into role?

I know that we can write separate mex endpoint for tcp in config file as a result we can create proxy with that mex url as a result when client would connect to service then tcp protocol will be used for communication but for other http endpoints one mex endpoint works fine.

My important question is which I really like to know that suppose i have 3 endpoints like basichttp,wshttp,wsdualbidning then one mex endpoint works for all of them to create proxy. so tell me in that case when client connect to service then which endpoint address will be used to connect to that service?

It will be great help if some one discuss this issue with great detail and with sample config entry and as well as sample service code?

UPDATED Part

Tom Redfern said...service endpoints is not required in case of internal use. suppose I have developed a service which is hosted in console apps and other client need to connect to that service. so tell me in this case how client can connect to service without proxy class and call various method of service. I just like to know without proxy how can I connect and call various method of wcf service. please come with some sample code for client side just to show how programmatically I can connect and call various method of wcf service without proxy.

1

1 Answers

0
votes

An endpoint needs a way of addressing it. This is both fundamental and reasonable.

Your argument that the client only requires a metadata endpoint address in order to resolve the actual service endpoints only holds true when you are exposing a metadata endpoint (which is by no means required) and when the consumer has no other means to consume the service (perhaps the service is public).

Most services are developed for internal consumption where the ability to bind directly to an endpoint via referencing a shared types assembly (rather than via a service proxy) is commonplace. Knowledge of the endpoint address in these instances is absolutely required.

If you read about the history of UDDI, this was designed as a means to distribute service metadata to consumers who would have no need to know anything else about the service. However, how often do you see a UDDI server? I have seen it used in exactly one company (I have worked in about 20 in total).