Recently one of my colleagues was facing an issue while executing a plugin in CRM 2011 OnPremise environment. In his plugin he was trying to push some data from CRM to Facebook using webservice exposed by Facebook.
The Web Service plug-in failed in OrganizationId: e04e7680-a484-e211-8a47-00155d8863b2; SdkMessageProcessingStepId: 1e269463-4795-e211-adef-00155d8863b2; EntityName: new_post; Stage: 20; MessageName: Create; AssemblyName: XYZ.Plugin.PushToFacebook, XYZ.Plugin, Version=126.96.36.199, Culture=neutral, PublicKeyToken=c345a3907d3249f7; ClassName: XYZ.Plugin.PushToFacebook; Exception: Unhandled Exception: System.Net.WebException: Unable to connect to the remote server
at XYZ.Plugin.PushToFacebook.Process(String message, String facebookPathPostId, IOrganizationService service)
at XYZ.Plugin.PushToFacebook.Execute(IServiceProvider serviceProvider)
at Microsoft.Crm.Extensibility.V5PluginProxyStep.ExecuteInternal(PipelineExecutionContext context)
at Microsoft.Crm.Extensibility.VersionedPluginProxyStepBase.Execute(PipelineExecutionContext context)
Inner Exception: System.Net.Sockets.SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 188.8.131.52:443
at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
at System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Int32 timeout, Exception& exception)
He complained that same plugin worked fine for him in OnLine scenario but failed in OnPremise.
In this particular scenario exception message clearly said that “A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond” the connection was not getting established properly
Things which could be causing problems:
- No Internet Exception – Check à Machine was connected to internet, he was able to explore service through browser
- Firewall – Check à Exception was set for specified ports for both inbound and outbound.
- Proxy – Check à It was set in LAN Settings in browser (Oooopsssss….)
So here was the problem, proxy was set for browser, not system/environment wide. So I asked him to use WebProxy object to make his call from plugin via proxy server and everything started working fine.
You can go through given link for looking into webproxy object:
Do comment if you find same exception and this solution doesn’t work.