09089 发表于 2016-1-29 08:18:48

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

                      wcf错误:由于编译过程中出现异常,无法激活服务“/roxlin/services/phcmesservice.svc”。异常消息为: 无法激活服务,因为它不支持 ASP.NET 兼容性。已为此应用程序启用了 ASP.NET 兼容性。请在 web.config 中关闭 ASP.NET 兼容性模式 ,或将 AspNetCompatibilityRequirements 特性添加到服务类型且同时将 RequirementsMode 设置为“Allowed”或“Required”。。错误(表象)原因:一般是因为程序添加了启用了AJAX的WCF服务,在添加WCF服务,浏览WCF服务时出现以上错误,而浏览AJAX的WCF服务不报错。在没有添加AJAX的WCF服务时也不报错。
解决:1.      web.config中 添加或修改    <system.serviceModel>               <serviceHostingEnvironment aspNetCompatibilityEnabled="fales"multipleSiteBindingsEnabled="true" />    </system.serviceModel>2.在服务前添加:(启用了AJAXD的WCF服务是默认添加的)
另:当前已禁用此服务的元数据发布错误解决:在web.config中添加:    <system.serviceModel>      <behaviors>            <serviceBehaviors>
                <behavior name="">
                  <serviceMetadata httpGetEnabled="true" />
                </behavior>
            </serviceBehaviors>
      </behaviors>    </system.serviceModel>
                   

页: [1]
查看完整版本: WCF 无法激活服务,因为它不支持 ASP.NET 兼容性