This project is read-only.

WebHttpServiceHost and service with multiple contracts

Topics: Web Api
Mar 17, 2011 at 5:43 PM


When I try to instantiate WebHttpServiceHost for a service that implements multiple ServiceContracts (via interfaces) I get the following error:

The contract specified by type 'X' is ambiguous.  The type derives from at least two different types that each define its own service contract.  For this type to be used as a contract type, exactly one of its inherited contracts must be more derived than any of the others.

It fails on ContractDescription contract = ContractDescription.GetContract(this.serviceType);
in Microsoft.ServiceModel.Http.WebHttpServiceHost.CreateEndpoints(Uri[] baseAddresses)

Traditional ServiceHost works just fine for the same service.

Any help is appreciated.