An exception occurred suddenly during the "openhost" operation on the WCF host today. The exception information is as follows:
Contractdescription "***" has zero operations. The agreement must have at least one operation.
English:
Contractdescription '*** 'has zero operations; a contract must have at least one operation.
It is also strange to say that during the batch "openhost" process, this exception occurs in a certain type in the middle. Most of the other operations are carried out based on the gourd painting scheme, which compares the code and configuration files, no major problems have been found. There are a lot of results from Google, but they never find the desired answer.
No way, let alone your own project to see how the system's own WCF Service is. One-to-one comparison, I found that I had made a low-level mistake.
"[Operationcontract]" is not added when defining service interfaces.
In the development process, we often bypass the WCF distributed application and implement the interface first, however, [servicecontract (name = "**")] is added to the application, but "[operationcontract]" is not added to the interface function. this may cause the exception mentioned above.
Of course, in my practice, some services can still run even if they are not added. The original committee has to go into details. I would like to remind you that you should follow the rules to avoid errors and do not know where to start.