无法激活服务,因为它不支持 ASP.NET 兼容性

wcf错误直接上图:

原因:

一般是因为程序添加了启用了AJAX的WCF服务而缺少相关设置出现的错误。

解决方案:

1.webconfig

<system.serviceModel>  

        <behaviors>

            <serviceBehaviors>                

      <behavior name="">                    

        <serviceMetadata httpGetEnabled="true" />                

       </behavior>            

    </serviceBehaviors>        

  </behaviors>

</system.serviceModel>

2.cs代码中

using System.ServiceModel.Activation ;

[AspNetCompatibilityRequirements (RequirementsMode=AspNetCompatibilityRequirementsMode.Required)]

posted @ 2014-12-17 18:51  点点_滴滴  阅读(422)  评论(0编辑  收藏  举报