码迷,mamicode.com
首页 > Web开发 > 详细

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

时间:2015-10-29 10:54:57      阅读:182      评论: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
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!