Problem :
I had a web service proxy, generated automatically from the CrmServiceWsdl.wsdl file of the Microsoft Dynamics CRM 4.0.
2. I was loading a big amount of data to the CRM via the web services.
3. In the middle of the load I was getting the following error:
I had a web service proxy, generated automatically from the CrmServiceWsdl.wsdl file of the Microsoft Dynamics CRM 4.0.
2. I was loading a big amount of data to the CRM via the web services.
3. In the middle of the load I was getting the following error:
Unable to connect to the remote server
System.Net.Sockets.SocketException: Only one usage of each socket address
(protocol/network address/port) is normally permitted.
Solution :
This is my Service Method
string url = http://localhost:5555/MSCrmServices/2007/CrmService.asmx;
string organizationName = "cmt";
CrmAuthenticationToken token = new CrmAuthenticationToken();
token.AuthenticationType = 0;
token.OrganizationName = organizationName;
_crmService = new CrmService();
_crmService.Url = url;
_crmService.CrmAuthenticationTokenValue = token;
_crmService.Credentials = System.Net.CredentialCache.DefaultCredentials;
Just two more line add in this method
_crmService.PreAuthenticate = true;
_crmService.UnsafeAuthenticatedConnectionSharing = true;
And issue solved.
Cool! Thanks for sharing these codes. It will really help.
ReplyDelete