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 737079
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T07:40:45+00:00 2026-05-14T07:40:45+00:00

I have a public interface auto-generated bu svcutil: [System.ServiceModel.ServiceContractAttribute(Namespace=…, ConfigurationName=…)] public interface MyInterface Then

  • 0

I have a public interface auto-generated bu svcutil:

[System.ServiceModel.ServiceContractAttribute(Namespace="...", ConfigurationName="...")]
public interface MyInterface

Then I have asmx web service inheriting it and working fine. I am trying ot convert it to WCF but when I instrument the service (in asmx.cs code behind) with ServiceContract:

[ServiceContract(Namespace = "...")]
public class MyService : MyInterface 

Also I have cerated .svc file and added the system.serviceModel setting in the config file. The goal is to migrate the asmx service to WCF service.

I’ve got this error:

The service class of type MyService both defines a ServiceContract and inherits a ServiceContract from type MyInterface. Contract inheritance can only be used among interface types. If a class is marked with ServiceContractAttribute, it must be the only type in the hierarchy with ServiceContractAttribute.

The asmx service is still working fine. Only the .svc is giving me issues. My question is how to fix that. MyInterface is an interface so I do not see what the problem is and why I’ve got the error anyway.

Note I do not want to change MyInterface, because it is autogenerated from svcutil from my wsdl schema and I do not want this interface to be edited manually. The whole idea is to have the service types automatically genereted from WSDL and to save my team development efforts with manual editing.

Any help is appreciated.

  • 1 1 Answer
  • 1 View
  • 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-05-14T07:40:45+00:00Added an answer on May 14, 2026 at 7:40 am

    You need to remove the ServiceContractAttribute from MyService class. This attribute is already defined in the interface and that’s the correct way of specifying that this interface will be exposed as WCF service.

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

Sidebar

Related Questions

I have an interface like so: public interface MyInterface<E extends Something1> { public void
I'm using Spring 3.0 with a genericDAO. I have this: public interface GenericDAO<T, ID
I have interface Foo public interface Foo { public void test(); } Class FooChild
I have an interface: public interface: IA { ... } and I try to
I have next interface public interface IMyInterface { string this[string key] { get; set;
I have this interface: public interface IValidationCRUD { public ICRUDValidation IsValid(object obj); private void
I have an interface: public interface IMyInterface { } I have a class which
I have the interface public interface IStoreItem { decimal Price { get; } }
I have a public facing interface that I'm trying to map two different enumerations
I have two files: public interface PrintService { void print(PrintDetails details); class PrintDetails {

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.