且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

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

更新时间:2022-06-25 01:42:21

原文http://www.cnblogs.com/xtechnet/archive/2012/06/06/2537979.html

测试发布到虚拟目录中时发生的报错现象,由于不支持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,如下图

 

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

 


作者:xTechnet
出处:http://xTechnet.cnblogs.com/
能力不济,但是乐于分享且没羞没臊,如有错误,请大力留言鄙视
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,好歹在文章页面明显位置给出原文连接,否则保留鄙视你的权利。