在使用Dynamics crm 365中的webapi的时候遇到过一些错误,下面总结一下错误:
出现错误:Failed to load resource: the server responded with a status of 404 (Bad Request)
1.路径有问题:在crm的开发过程中,我们经常会用到在js中查询数据, dynamics提供了webapi供我们使用,但在使用的 时候不是直接通过实体名去进行查询的。 实体名以s结尾,如 tb_crms,查询的时候就是tb_crmses,后面加es 以y结尾:tb_crmy---tb_crmies 以es结尾:tb_crmes---tb_crmeses 其他的通通加s;
出现错误:Failed to load resource: the server responded with a status of 500 (Bad Request)
2.参数类型和参数类型不匹配,比如客户实体string 类型,销售线索是date类型;也有可能是参数类型匹配,但是名称错误:比如两个实体都有年龄,但是字段命名不一致。
出现错误:Failed to load resource: the server responded with a status of 400 (Bad Request)
出现这些错误一般情况是:
3.可能是插件和所写的webapi代码冲突了
出现错误:
"An unexpected error occurred from ISV code.
(ErrorType = ClientError) Unexpected exception from plug-in (Execute):
JNDL.CRM.Action.new_offer_price.offer_price_skill_confirmAction:
System.IO.FileNotFoundException: 未能加载文件或程序集“
Newtonsoft.Json, Version=11.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed”
4.未能加载文件或程序集“Newtonsoft.Json ,Version=11.0.0.0
解决方法:在vs中添加Newtonsoft.Json程序集并且把版本更新为11.0.0.0
5.如果在插件注册的时候找不到创建的类,那么可能是vs中的类中的方法缺少(public)
6.message:"An unexpected error occurred from ISV code.
(ErrorType = ClientError) Unexpected exception from plug-in (Execute):
PluginProfiler.Plugins.ProfilerPlugin: System.Security.SecurityException:
无法在部分信任中序列化数据约定类型“Microsoft.Xrm.Sdk.OrganizationServiceFault”,
因为属性“ExceptionRetriable”没有公共 getter。"
错误消息详情:可能是查找类型的值不匹配查找类型中的实体(报错时,错误消息不会进到profiling中)
解决方法:修改代码中涉及到查找类型的值,(如果是全局的查找类型,就将需要的实体活动选择上)