c# - Strange exception on WCF endpoint launch -


I'm getting the following exception and there is no clue about what else to be decided:

Operation 'sodata' can not be loaded because it has a parameter or return type type System.ServiceModel.Channels.Message or a type that has MessageContractAttribute and other types of other parameters. When using type with System.ServiceModel.Channels.Message or MessageContractAttribute, the method should not use any other type of parameter.

My code: [Service contract (SessionMode = session mode.). Public interface IHelper {[WebGet (UriTemplate = "/ cgi / manager .exe? GetData = {data} ")) [OperationContract] Message ShowData (int data); } Public class assistant: iHelper {public message ShowData (int data) {var results = new StringBuilder (...); Foreach (...) {Results AppendFormat (...); } result. AppendLine (...); Return WebOperationContext.Current.CreateTextResponse (Results.tostring (), "text / xml", encoding.ASCII); }

I think it says that I can not separate the int with the message ?

You are receiving the error because what is the right way to parse the request because of you ? Returning WCF messages type This means that you have to remove the data parameter from the input, or type it in a message instead of int .

Message The square is the basic piece of WCF infrastructure. It has been documented here:

Instead of using the message , it is better to define your data-contract type.


Comments