我的帮助将受到高度赞赏,我已在CRM Dynamics 2015中注册了一个电话插件创建,当我使用探查器调试插件时,插件注册工具一打电话就停止工作WCF服务客户端方法暴露。我已经尝试过ASXM服务和WCF服务,我已经在IIS上部署了服务托管的同一台服务器上的CRM,我在控制台和SOAP UI上测试了服务,一切正常,我用它的那一刻亲属插件上下文在服务调用时崩溃了注册工具。插件注册工具日志文件中没有记录错误,这是我的插件代码
public void Execute(IServiceProvider serviceProvider)
{
IPluginExecutionContext context = (IPluginExecutionContext)serviceProvider.GetService(typeof(IPluginExecutionContext));
if (context == null)
{
throw new ArgumentNullException("localContext");
}
IOrganizationServiceFactory serviceFactory = (IOrganizationServiceFactory)serviceProvider.GetService(typeof(IOrganizationServiceFactory));
IOrganizationService service = serviceFactory.CreateOrganizationService(context.InitiatingUserId);
if (context.InputParameters.Contains("Target") && context.InputParameters["Target"] is Entity)
{
Entity phoneCallEntity = (Entity)context.InputParameters["Target"];
if (phoneCallEntity.LogicalName != "phonecall")
return;
//ensure that the Plugin fires on a create operaton
if (context.MessageName == "Create")
{
try
{
BasicHttpBinding myBinding = new BasicHttpBinding();
myBinding.Name = "BasicHttpBinding_IService1";
myBinding.Security.Mode = BasicHttpSecurityMode.None;
myBinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.None;
myBinding.Security.Transport.ProxyCredentialType = HttpProxyCredentialType.None;
myBinding.Security.Message.ClientCredentialType = BasicHttpMessageCredentialType.UserName;
EndpointAddress endPointAddress = new EndpointAddress("http://154.66.196.127/Webservice/ZoiperCallHistory.asmx");
ZoiperCallHistorySoapClient client = new ZoiperCallHistorySoapClient(myBinding,endPointAddress);
client.Open();
CallHistory callHistory = client.GetZoiperCallHistory();
client.GetZoiperCallHistory();
此行代码失败:CallHistory callHistory = client.GetZoiperCallHistory();
提前致谢。
答案 0 :(得分:1)
根据我的经验,插件注册工具不适合调试Web服务调用。请尝试使用跟踪服务来识别错误或分析Web服务响应。
ITracingService tracingService =
(ITracingService)serviceProvider.GetService(typeof(ITracingService));