Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8594317
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T00:10:17+00:00 2026-06-12T00:10:17+00:00

So, due to some concerns, I’ve split up what was initially a single interface

  • 0

So, due to some concerns, I’ve split up what was initially a single interface contract into two separate ones. Now, I have only one class (partial) implementing both interfaces, and I want to make them all available as REST-services through WCF. The contracts are listed below.

I am using Autofac for WCF service host.

Below is my .svc file code

For WCF service: Factory="Autofac.Integration.Wcf.AutofacServiceHostFactory, Autofac.Integration.Wcf"

For RESTful service: Factory="Autofac.Integration.Wcf.AutofacWebServiceHostFactory, Autofac.Integration.Wcf"

WCF Example:

For wcf service

public interface IEmployeeCommandService {}
public interface IEmployeeQueryService {}
public partial class EmployeeService : IEmployeeCommandService {}
public partial class EmployeeService : IEmployeeQueryService {}
public partial class EmployeeService {}

And my Web.config file looks like below

<service behaviorConfiguration="ServiceBehavior" name="Application.EmployeeService">
    <endpoint address="" binding="basicHttpBinding" contract="Application.IEmployeeCommandService" />
    <endpoint address="" binding="basicHttpBinding" contract="Application.IEmployeeQueryService" />
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>

And my EmployeeService.svc code looks like

<%@ ServiceHost Service="Application.EmployeeService, Application"
Factory="Autofac.Integration.Wcf.AutofacServiceHostFactory, Autofac.Integration.Wcf"%>

with this approach the plain WCF service working fine for me. When browse the EmployeeService.svc I can see both command & Query service operations.

Simillar approach I am trying for RESTFul service as mentioned like below. But I am getting error when I browse my RESTFul service.

RESTFul Example:

public interface IEmployeeRESTfulQueryService {}
public interface IEmployeeRESTfulCommandService {}
public partial class EmployeeRESTfulService {}
public partial class EmployeeRESTfulService : IEmployeeRESTfulCommandService {}
public partial class EmployeeRESTfulService : IEmployeeRESTfulQueryService {}

And My web.confing looks like below

  <service behaviorConfiguration="ServiceBehavior" name="Application.EmployeeRESTfulService">
    <endpoint name="Command" address="Command" behaviorConfiguration="webHttp" binding="webHttpBinding" contract="Application.IEmployeeRESTfulCommandService" />
    <endpoint name="Query" address="Query" behaviorConfiguration="webHttp" binding="webHttpBinding" contract="Application.IEmployeeRESTfulQueryService" />
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
  </service>

<behavior name="webHttp">
 <webHttp helpEnabled="true" automaticFormatSelectionEnabled ="true" />
</behavior>

If I browse my .svc (RESTFul) I endup with below error..

Error:

Service ‘EmployeeRESTfulService’ implements multiple ServiceContract types, and no endpoints are defined in the configuration file. WebServiceHost can set up default endpoints, but only if the service implements only a single ServiceContract. Either change the service to only implement a single ServiceContract, or else define endpoints for the service explicitly in the configuration file..

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T00:10:18+00:00Added an answer on June 12, 2026 at 12:10 am
    1. Do you use the Factory=System.ServiceModel.Activation.WebServiceHostFactory on the .svc file? If so, remove the Factory attribute, since you’re defining the endpoints in config.
    2. An endpoint in WCF is bound to a contract (interface); if you have two different interfaces, you’ll need two different endpoints.

    Update following edit: the Factory used by the restful service, Autofac.Integration.Wcf.AutofacWebServiceHostFactory, Autofac.Integration.Wcf, is using the WebServiceHost, which requires the service class to implement only one [ServiceContract] interface. Do you need the Autofac factory? If not, just remove that attribute; otherwise, since you’re already defining the endpoints via config, I imagine it should work with the “normal” factory (AutofacServiceHostFactory) as well (I’ve never used Autofac, but you can try that).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Due to some changes on AD-level I have to change a lookup in AD
I have some idea that it is due to some complex calculation, but i
I have this issue: Due to design concerns, the ASP.NET webpage I am currently
Due to some css limitations between IE and the rest of the world I
Due to some limitations on the place files are being placed, I would like
Due to some rather bizarre architectural considerations I've had to set up something that
due to some unavoidable reasons I need to disable Google Chrome's Chrome PDF Viewer
I noticed some XSS attempts on some of our sites due to some old
I've recently switched focus from VB.NET to C# due to some decisions at work.
I'm having some issues with my code. This is probably due to some design

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.