Message or a type that has MessageContractAttribute and other parameters of different types

Viewed 24416

I'm developing WCF services where some classes have the [MessageContract] attribute, and some don't.

When I try to run the services I get this error message below:

The operation 'ProcessOperation' could not be loaded because it has a parameter or return type of type System.ServiceModel.Channels.Message or a type that has MessageContractAttribute and other parameters of different types. When using System.ServiceModel.Channels.Message or types with MessageContractAttribute, the method must not use any other types of parameters.

Does it mean that all the services must have [MessageContract] although they are not related?

6 Answers

When you are using Message object as a parameter, the method should return void

I ran into this error while maintaining an API in our code. The API suddenly began returning this error for all endpoints. I had upgraded the initialization method for Ninject to move away from a method that it said was obsolete.

Obsolete method: NinjectWebServiceHostFactory (no error) 
New method:      NinjectServiceHostFactory    (returns error)

The error went away when I reverted the change.

Related