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)]