2
votes

Your help will be highly appreciated, I have registered a Plug-in on phone call create in CRM Dynamics 2015, When I debug the plugin using the profiler, the plugin Registration tool stops working as soon as I make a call to the WCF service client method exposed. I have tried with both an ASXM service and a WCF service,i have deployed the service in IIS on the same server CRM is hosted,I tested the service against a console and SOAP UI, everything works fine, the minute I use it kin a Plugin context it crashed the registration tool on service call. There is no error logged in the plugin Registration tool log files, here is my plugin code below

 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();

The code fails on this line : CallHistory callHistory = client.GetZoiperCallHistory();

Thanks in advance.

1
the plugin is registered as isolation "none" (outside the sandbox)?Guido Preite
I believe that your issue is related to fact that you use IP address instead of FQDN. Recheck this article - msdn.microsoft.com/en-us/library/…Andrew Butenko

1 Answers

1
votes

In my experience the plugin registration tool doesn't go well with debugging web service calls. Try instead using the tracing service to identify errors or to analyze the web service response.

ITracingService tracingService =
(ITracingService)serviceProvider.GetService(typeof(ITracingService));