简体   繁体   English

WCF REST服务的兼容性错误

[英]Compatibility error on WCF rest service

when I added 当我添加

[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Required)]

in wcf rest service and 在WCF休息服务和

<serviceHostingEnvironment aspNetCompatibilityEnabled="true"/>

in webconfig im getting error as 在webconfig中我收到错误

The service cannot be activated because it does not support ASP.NET compatibility. 无法激活该服务,因为它不支持ASP.NET兼容性。 ASP.NET compatibility is enabled for this application. 为此应用程序启用了ASP.NET兼容性。 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'. 在web.config中关闭ASP.NET兼容模式,或将AspNetCompatibilityRequirements属性添加到服务类型,并将RequirementsMode设置设置为“允许”或“必需”。

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 .... 实际上,当我在本地主机上运行服务时,它的工作正常,但是当我承载该服务时,它引发了错误。.实际上,我需要这个bcos im计划在wcf rest服务中实现缓存。

you can do this by updating you web.config file as follows: 您可以通过如下方式更新web.config文件来做到这一点:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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