作者:jiankunking 出处:http://blog.csdn.net/jiankunking

错误信息:

无法激活服务。由于它不支持 ASP.NET 兼容性。已为此应用程序启用了 ASP.NET 兼容性。请在 web.config 中关闭 ASP.NET 兼容性模式,或将 AspNetCompatibilityRequirements 特性加入到服务类型且同一时候将 RequirementsMode 设置为“Allowed”或“Required”。
说明: 运行当前 Web 请求期间,出现未经处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的具体信息。 异常具体信息: System.InvalidOperationException: 无法激活服务,由于它不支持 ASP.NET 兼容性。已为此应用程序启用了 ASP.NET 兼容性。 请在 web.config 中关闭 ASP.NET 兼容性模式,或将 AspNetCompatibilityRequirements 特性加入到服务类型且同一时候将 RequirementsMode 设置为“Allowed”或“Required”。 源错误: 运行当前 Web 请求期间生成了未经处理的异常。 能够使用以下的异常堆栈跟踪信息确定有关异常原因和发生位置的信息。 堆栈跟踪: [InvalidOperationException: 无法激活服务,由于它不支持 ASP.NET 兼容性。已为此应用程序启用了 ASP.NET 兼容性。请在 web.config 中关闭 ASP.NET 兼容性模式,或将 AspNetCompatibilityRequirements 特性加入到服务类型且同一时候将 RequirementsMode 设置为“Allowed”或“Required”。 ]
System.ServiceModel.Activation.HostedAspNetEnvironment.ValidateCompatibilityRequirements(AspNetCompatibilityRequirementsMode compatibilityMode) +184808
System.ServiceModel.Description.DispatcherBuilder.ValidateDescription(ServiceDescription description, ServiceHostBase serviceHost) +391
System.ServiceModel.Description.DispatcherBuilder.InitializeServiceHost(ServiceDescription description, ServiceHostBase serviceHost) +306
System.ServiceModel.ServiceHostBase.InitializeRuntime() +82
System.ServiceModel.ServiceHostBase.OnOpen(TimeSpan timeout) +64
System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout) +789
System.ServiceModel.HostingManager.ActivateService(String normalizedVirtualPath) +287
System.ServiceModel.HostingManager.EnsureServiceAvailable(String normalizedVirtualPath) +1132 [ServiceActivationException: 由于编译过程中出现异常。无法激活服务“/AMACTEST/RightManagementServer.svc”。异常消息为: 无法激活服务,由于它不支持 ASP.NET 兼容性。 已为此应用程序启用了 ASP.NET 兼容性。 请在 web.config 中关闭 ASP.NET 兼容性模式,或将 AspNetCompatibilityRequirements 特性加入到服务类型且同一时候将 RequirementsMode 设置为“Allowed”或“Required”。。]
System.Runtime.AsyncResult.End(IAsyncResult result) +890624
System.ServiceModel.Activation.HostedHttpRequestAsyncResult.End(IAsyncResult result) +180062
System.Web.CallHandlerExecutionStep.OnAsyncHandlerCompletion(IAsyncResult ar) +136

解决方式:

1、改动对应服务.svc.cs,在类上加入以下标识

using System.ServiceModel.Activation ;
[AspNetCompatibilityRequirements (RequirementsMode=AspNetCompatibilityRequirementsMode.Required)]

据说:启用了AJAX的WCF服务是默认加入的

请移步到小注中的链接,谢谢

小注:

更具体的问题分析參考:

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'. 
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidOperationException: 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'.

WCF 无法激活服务,由于它不支持 ASP.NET 兼容性。已为此应用程序启用了 ASP.NET 兼容性的更多相关文章

  1. WCF 无法激活服务,因为它不支持 ASP.NET 兼容性。已为此应用程序启用了 ASP.NET 兼容性

    无法激活服务,因为它不支持 ASP.NET 兼容性.已为此应用程序启用了 ASP.NET 兼容性.请在 web.config 中关闭 ASP.NET 兼容性模式,或将 AspNetCompatibil ...

  2. 开发错误处理记录(无法激活服务,因为它不支持 ASP.NET 兼容性)

    错误提示:无法激活服务,因为它不支持 ASP.NET 兼容性.已为此应用程序启用了 ASP.NET 兼容性.请在 web.config 中关闭 ASP.NET 兼容性模式或将 AspNetCompat ...

  3. 重启IIS报错:IIS 服务或万维网发布服务,或者依赖这 服务可能在启动期间发生错误或者已禁用

    参考文章: http://www.cnblogs.com/zengen/archive/2010/10/29/1864569.html 开启如下服务: Net.Msmq Listener Adapte ...

  4. IIS 服务或万维网公布服务,或者依赖这 服务可能在启动期间错误发生或者已禁用

    作者:jiankunking 出处:http://blog.csdn.net/jiankunking 详细错误信息例如以下: 解决方式: 在服务中禁用下面3个服务自己主动启动: Net.Msmq Li ...

  5. WCF调试异常信息:ServiceHost 仅支持类服务类型

    "/CommonHelpServices"应用程序中的server错误. ServiceHost 仅支持类服务类型. 说明: 运行当前 Web 请求期间,出现未经处理的异常. 请检 ...

  6. 如何让WCF服务更好地支持Web Request和AJAX调用

    WCF的确不错,它大大地简化和统一了服务的开发.但也有不少朋友问过我,说是在非.NET客户程序中,有何很好的方法直接调用服务吗?还有就是在AJAX的代码中(js)如何更好地调用WCF服务呢? 我首先比 ...

  7. WCF项目问题2-无法激活服务,因为它需要 ASP.NET 兼容性。没有未此应用程序启用 ASP.NET 兼容性。请在 web.config 中启用 ASP.NET 兼容性,或将 AspNetCompatibilityRequirementsAttribute.AspNetCompatibilityRequirementsMode 属性设置为 Required 以外的值。

    无法激活服务,因为它需要 ASP.NET 兼容性.没有未此应用程序启用 ASP.NET 兼容性.请在 web.config 中启用 ASP.NET 兼容性,或将 AspNetCompatibility ...

  8. WCF入门(三)---WCF与Web服务/Web Service

    下面列出了WCF和Web服务之间存在一些重大差异. 属性:WCF服务是通过定义ServiceContract和OperationContract属性,而在Web服务,WebService和WebMet ...

  9. 跟我一起学WCF(12)——WCF中Rest服务入门

    一.引言 要将Rest与.NET Framework 3.0配合使用,还需要构建基础架构的一些部件.在.NET Framework 3.5中,WCF在System.ServiceModel.Web组件 ...

随机推荐

  1. Ruby按照换行符进行分割

    Ruby按照换行符进行分割 string.split(/\n/)

  2. Android 经常使用设计模式(一)

    由于项目变更的频繁性,作为一名程序猿,我们须要掌握设计模式的必要性.就不言而喻~~.以下就是一些我自己学习的设计模式总结. 接下来,主要是针对几个比較经常使用模式进行解说,主要是以下几种: 观察者模式 ...

  3. Android 开源项目android-open-project解析之(二) GridView,ImageView,ProgressBar,TextView

    五.GridView StaggeredGridView 同意非对齐行的GridView,类似Pinterest的瀑布流.而且跟ListView一样自带View缓存,继承自ViewGroup 项目地址 ...

  4. windows、linux劫持技术

    windows系统以下能够利用detours劫持 realse  模式劫持,调试的程序不能够 函数劫持能够实现的效果. 函数的劫持原理 我们怎样实现-detours detours是微软亚洲研究院出品 ...

  5. 2015.04.23,外语,读书笔记-《Word Power Made Easy》 12 “如何奉承朋友” SESSION 33

    1.eat, drink, and be merry 拉丁动词vivo(to live),加上名词vita(life),是许多重要英文词汇的来源. convivo是拉丁动词to live togeth ...

  6. XCode下Swift – WebView IOS demo

    简介 我今天用Mac升级了XCode到8.1,Swift版本应该到了swift3,按网上的demo写webview的例子,报一堆错,整了一天才搞定,不想其他人踩坑了! XCode8.1 ,swift3 ...

  7. Oracle 查看锁定表用户的SQL

    #描述:当执行如下SQL select * From XXX for Updata 发现表“XXX”被锁定 #只需要执行如下SQL 查看锁定该表的用户 SELECT object_name, mach ...

  8. 软件测试中的fault,error,failure

    问题:给定两段代码,设计fault,error,failure的测试用例. fault:即引起错误的原因,类似病因. error:类似疾病引起的内部结果. failure:类似疾病引起的症状. 代码1 ...

  9. 错误:java.lang.IllegalArgumentException: Receiver not registered

    Caused by: java.lang.IllegalArgumentException: Receiver not registered: com.multak.cookaraclient.Mai ...

  10. signature验证/salt验证/token验证的作用

    1.salt验证: salt是随机生成的一串字符,salt验证的作用是将生成的salt与加密的密码密文拼接后再次加密存储  这样可以是存储在数据库中的密码更加安全 2.signature验证: I.将 ...