tags:

views:

194

answers:

1

I created a service which allows clients to search for user information. This is exposed as an interface ISearchUsers.

I used this article as a base but to no avail: Not sure if this is the way to go link text

Now I want to create and expose an interface called ICreateUser and i assumed that i had to create a new endpoint , basicHttp binding and used the article above.

This is part of my config:

 <services>
      <service behaviorConfiguration="Service.Service1Behavior"
        name="Service.SearchService">
        <clear />
        <endpoint binding="basicHttpBinding" bindingConfiguration="WsHttpMtomBinding"
          contract="Service.ISearchService" listenUriMode="Explicit">
          <identity>
            <dns value="localhost" />

          </identity>
        </endpoint>
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"
          listenUriMode="Explicit">

        </endpoint>
        <host>
          <baseAddresses>
            <add baseAddress="http://localhost:8731/Service/Service1/" />
          </baseAddresses>
        </host>
      </service>
    </services>
A: 

You can extend your current service class which implements ISearchUser and let it implement ICreateUser as well - in that case, you could add a second endpoint to your service config:

<services>
  <service name="Service.SearchService"
           behaviorConfiguration="Service.Service1Behavior">
     <host>
        <baseAddresses>
           <add baseAddress="http://localhost:8731/Services/" />
        </baseAddresses>
     </host>
     <endpoint 
          address="SearchUser"
          binding="basicHttpBinding" bindingConfiguration="WsHttpMtomBinding"
          contract="Service.ISearchService">
        <identity>
          <dns value="localhost" />
        </identity>
     </endpoint>
     <endpoint 
          address="CreateUser"
          binding="basicHttpBinding" bindingConfiguration="WsHttpMtomBinding"
          contract="Service.ICreateUserService">
        <identity>
          <dns value="localhost" />
        </identity>
     </endpoint>
     <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
   </service>
</services>

One thing that most likely doesn't work in your case is the fact you pick "basicHttpBinding" as your binding, but the bindingConfiguration seems to indicate WsHttpBidning..... those need to match and thus should probably be:

<endpoint 
    address="CreateUser"
    binding="basicHttpBinding" bindingConfiguration="basicHttpMtomBinding"
    contract="Service.ICreateUserService">

Marc

marc_s
marc_s:followed your recommendation. Code compiles and running it brings up the WCF service host and this is the error.System.InvalidOperationException: The contract name 'Service.IRegisterationService' could not be found in the list of contracts implemented by the service 'SearchService'. at System.ServiceModel.Description.ConfigLoader.LookupContract(String contractName, String serviceName) at ...
Not sure if this gives additional info. right click on app.config and choose edit wcf configuration. Brings up UI. Expand 'services' and right click on 'service.searchservice'. Then click on '...' under name and choose the compiled dll from the bin dir. There are 2 service types i can choose from
Does your class "SearchService" actually implement the "Service.IRegistrationService" contract??
marc_s
When you say there are two service types to choose from - do you mean two separate classes that each implement one service contract? In order for this to work, you will need to have a **single** service class that impmlements both service contracts: `class MyService : IRegisterationService, ICreateUserService`
marc_s