WCF cannot activate the service because it does not support ASP.

Source: Internet
Author: User

<system.serviceModel> ...    .    <servicehostingenvironment aspnetcompatibilityenabled= "true"  multiplesitebindingsenabled= "true"/>  </system.serviceModel>

If the configuration of aspnetcompatibilityenabled such as in WCF configuration, the corresponding ServiceContract implementation class is also added to the corresponding declaration, as follows:

[ServiceContract]Interfaceimycontract {[OperationContract]stringMyMethod (stringtext); [OperationContract]stringMyothermethod (stringtext); }[Aspnetcompatibilityrequirements (Requirementsmode = aspnetcompatibilityrequirementsmode.required)]  Public classMyservice:imycontract { Public stringMyMethod (stringtext) {            return string. Format ("hello,{0}", text); }         Public stringMyothermethod (stringtext) {            return string. Format ("cannot call this method over wcf,{0}", text); }    }

VS, when creating a WCF service, the compatibility mode is added, and if a declaration of compatibility mode is missing when the contract is implemented, an error occurs.

The service cannot be activated because it requires ASP. ASP. NET compatibility is not enabled for this application. Either enable ASP. NET compatibility in Web. config, or set the Aspnetcompatibilityrequirementsattribute.aspnetcompatibilityrequirementsmode property to A value other than Required.

Example of compatibility mode usage: http://www.cnblogs.com/artech/archive/2009/06/25/1511165.html

WCF cannot activate the service because it does not support ASP.

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: info-contact@alibabacloud.com 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.