首页 > Web开发 > 详细

The service cannot be activated because it does not support ASP.NET compatibility

时间:2015-10-29 10:53:32      阅读:499      评论:0      收藏:0      [点我收藏+]

刚刚在ASP.NET创建一个Service,在运行时,它即显示异常:
技术分享

 

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

解决方法,你需要为你的Service添加一个属性:
技术分享


第#11行代码:

[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]


上面的解决方法,它只是为单独某一个Service。如果你有多个Service时,那需要在每一个Service均需要添加上面的属性。
有一个更好的方法,就是修改web.config:
技术分享


 

 

The service cannot be activated because it does not support ASP.NET compatibility

原文:http://www.cnblogs.com/insus/p/4919539.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!