Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WCF Service Endpoints vs Host Base address

so i'm a litle confused over what the service endpoints and host base address is for. In all the examples i have walked through so far they talk about setting up the endpoints with the required bindings and you can normally navigate to those endpoints

Hoever when i use the following config to set up and host my service it only seems to expose the Hosts base address.

    <configuration>       <system.web>         <compilation debug="true" />       </system.web>       <!-- When deploying the service library project, the content of the config file must be added to the host's       app.config file. System.Configuration does not support config files for libraries. -->       <system.serviceModel>         <services>           <service name="HostService.EvalService">             <endpoint address="http://localhost:8080/basic"               binding="basicHttpBinding" contract="HostService.IEvalService" />             <endpoint address="http://localhost:8080/ws"               binding="wsHttpBinding" contract="HostService.IEvalService" />             <endpoint address="mex" binding="mexHttpBinding"               name="mex" contract="IMetadataExchange" />             <host>               <baseAddresses>                 <add baseAddress="http://localhost:8080/EvalsService" />               </baseAddresses>             </host>           </service>         </services>         <behaviors>           <serviceBehaviors>             <behavior name="">               <serviceMetadata httpGetEnabled="true" />               <serviceDebug includeExceptionDetailInFaults="false" />             </behavior>           </serviceBehaviors>         </behaviors>       </system.serviceModel>     </configuration> 

Can someone explain this to me?

like image 417
Ryan Burnham Avatar asked Aug 04 '11 07:08

Ryan Burnham


People also ask

What is endpoint address in WCF?

The endpoint address is represented in the Windows Communication Foundation (WCF) programming model by the EndpointAddress class, which contains an optional Identity property that enables the authentication of the endpoint by other endpoints that exchange messages with it, and a set of optional Headers properties, ...

How many endpoints can a WCF Service have?

The service configuration has been modified to define two endpoints that support the ICalculator contract, but each at a different address using a different binding.

Can WCF service have multiple endpoints?

Sometimes in our mind the question arise; can we implement multiple service contract in WCF service? And the answer is, Yes we can. Service class implement multiple service interfaces, and then expose each service using a different endpoint.

What are default endpoints in WCF?

Default EndpointsIf the service host does not define any endpoints (neither in config nor programmatically) but does provide at least one base address, WCF will by default add endpoints to the service. These are called the default endpoints.


1 Answers

When you host the WCF service on IIS, the base address can only be the URL to the .svc file. If you specify any other base address, it's ignored. You can still specify the relative URI for your endpoints, such as address="basic" or address = "ws". Then the address on the endpoint becomes <URL to the .svc file>/basic and <URL to the .svc file>/ws in this case.

like image 96
Kiran Mothe Avatar answered Sep 24 '22 19:09

Kiran Mothe