WCF 无法激活服务,因为它不支持 ASP.NET 兼容性。已为此应用程序启用了 ASP.NET 兼容性
2015-08-19 20:26
671 查看
作者:jiankunking 出处:http://blog.csdn.net/jiankunking
错误信息:
解决方案:
1、修改相应服务.svc.cs,在类上添加以下标识
据说:启用了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'.
错误信息:
无法激活服务,因为它不支持 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'.
相关文章推荐
- asp.net 批量上传图片保存到数据库
- asp.net MVC5 sitemap 的使用
- 图片缩放显示(UIViewContentModeScaleAspectFit) 要 从顶部开始显示的解决方法
- asp网页无法打开
- Asp.Net 请求处理机制
- ASP.NET MVC Json()处理大数据异常解决方法
- aspose.Cells 导出Excel
- casperjs/phantomjs资料收集
- Aspose.Words使用教程之插入文档元素(二)【连载】
- icinga-report+jasperserver+icinga-web安装步骤
- ASP.NET MVC架构与实战系列之一:理解MVC底层运行机制
- 关于asp.net 的一些好资料地址 , 防止丢失!
- asp.net中string和byte[]转换
- ASP.NET前台AJAX方法调用后台的方法写法
- asp.net TreeView綁定數據庫
- spring AspectJ的Execution表达式说明
- asp.net中如何调用sql存储过程实现分页
- VS2012自带的 性能分析 工具使用实例
- [Python爬虫] 在Windows下安装PhantomJS和CasperJS及入门介绍(上)
- asp.net中如何调用sql存储过程实现分页