zoukankan      html  css  js  c++  java
  • The service cannot be activated because it does not support ASP.NET compatibility

    刚刚在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:


     

  • 相关阅读:
    文件操作与函数
    编码格式
    if、while、for快速掌握
    运算符、数据类型、数据结构
    正则表达式
    面向对象--属性
    面向对象--对象的创建
    函数的内置属性
    类型检查
    函数表达式 及 闭包
  • 原文地址:https://www.cnblogs.com/insus/p/4919539.html
Copyright © 2011-2022 走看看