In WCF, "There must be no operation; the Protocol must have at least one operation"

Source: Internet
Author: User

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.

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.



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.