The operation 'xxx' 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. I wrote an interface to upload files in WCF and want to return the upload result, the interface is as follows:
At this time, the run will report an error if it is written as follows:
Errors will also be reported when running!!!!
As we said earlier, what is duplexing, there is a back-and-forth, right? Yes, the above method has incoming parameters and return values, there are comings and goings, it is duplex, why not?
Haha, the problem is that we use the message protocol, under this premise, our method cannot be defined casually, using the message protocol method, if:
a. If the message contract is used as an incoming parameter, there can only be one parameter, and the following definitions are incorrect:
void Reconcile(BankingTransaction bt1, BankingTransaction bt2);
b. Unless you return void, if not, then you must return a message contract, bool UpLoadFile(TransferFileMessage tMsg) Our definition obviously does not meet the requirements.
So how to solve it? We need to define another message contract for returning.
Roughly speaking, you can't use bool, string, etc. as return values, you can set void no return value type.
However, I wonder what if there is a return value???? The solution is as follows:
|