WCF ServiceContract and svcutil issue

Posted by Valko on Stack Overflow See other posts from Stack Overflow or by Valko
Published on 2010-04-21T11:06:13Z Indexed on 2010/04/21 11:13 UTC
Read the original article Hit count: 299

Filed under:
|
|

Hi,

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.

© Stack Overflow or respective owner

Related posts about wcf

Related posts about servicecontract