简体   繁体   中英

Compatibility error on WCF rest service

when I added

[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Required)]

in wcf rest service and

<serviceHostingEnvironment aspNetCompatibilityEnabled="true"/>

in webconfig im getting error as

The service cannot be activated because it does not support ASP.NET compatibility. ASP.NET compatibility is enabled for this application. Turn off ASP.NET compatibility mode in the web.config or add the AspNetCompatibilityRequirements attribute to the service type with RequirementsMode setting as 'Allowed' or 'Required'.

Actually its working fine when I run service in localhost but its throwing the error when I host the service.. Actually I need this bcos im planning to implement caching in wcf rest service.. Please help ....

you can do this by updating you web.config file as follows:

<system.webServer>
    <security>
        <authentication>
            <basicAuthentication enabled="false" />
        </authentication>   
    </security>
</system.webServer>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM