您的位置:首页 > 编程语言 > ASP

WCF发布由于不支持asp.net兼容性而导致服务无法激活启用

2012-06-06 11:36 423 查看
测试发布到虚拟目录中时发生的报错现象,由于不支持asp.net兼容性而导致服务无法激活启用

错误信息:

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'.

不要看到英文错误信息就一脸迷茫 人家的错误信息显示的很明显了:

1.web.config中增加<serviceHostingEnvironment aspNetCompatibilityEnabled="false">。注意这个是放在<system.serviceModel>中的

2.在wcf的服务类加上附加属性 AspNetCompatibilityRequirements,如下图

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐