The communication object, System.ServiceModel.Channels.ServiceChannel, cannot be used for communication because it is in the Faulted state.??
-
Wednesday, May 02, 2012 4:13 PM
The communication object, System.ServiceModel.Channels.ServiceChannel, cannot be used for communication because it is in the Faulted state.
i got this error when trying to connect to CRM 2011 using Service Refrence
CRM 2011 has changed to use ADFS so it is causing the issue before it was working correctly what to do??
Please Help its urgent
Thanks In Advance
- Edited by krunal89 Wednesday, May 02, 2012 4:34 PM
All Replies
-
Wednesday, May 02, 2012 4:53 PManybody please help
-
Wednesday, May 02, 2012 5:09 PMModerator
Hi,
Are you able to connect CRM, Is it working ok without any issue not certification error???
what code you are using to connect share it here
Mahain : Check My Blog
Follow me on Twitter
Make sure to "Vote as Helpful" and "Mark As Answer",if you get answer of your question. -
Wednesday, May 02, 2012 5:14 PM
Yes
ServicePointManager.ServerCertificateValidationCallback = delegate(object s, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors) { return true; };
_webServiceObject = new OrganizationServiceClient();
EndpointAddress _endaddress = new EndpointAddress(new Uri(Setting.DestinationConnection.WebService));
_webServiceObject.Endpoint.Address = _endaddress;
if (Convert.ToBoolean(Setting.DestinationConnection.isWindowsAuth))
{
_webServiceObject.ClientCredentials.Windows.ClientCredential = (System.Net.NetworkCredential)System.Net.CredentialCache.DefaultCredentials;
}
else
{
_webServiceObject.ClientCredentials.Windows.ClientCredential = new System.Net.NetworkCredential(Setting.DestinationConnection.UserName, Setting.DestinationConnection.Pwd, Setting.DestinationConnection.Domain);
}
_webServiceObject.ClientCredentials.Windows.AllowedImpersonationLevel = System.Security.Principal.TokenImpersonationLevel.Impersonation;
static void CreateOpportunity()
{
service = GetService();
Entity myContact = new Entity();
myContact.LogicalName = "opportunity";
//EntityReference t = new EntityReference();
// t.LogicalName = "account";
// t.Id =new Guid("6ab5a492-7288-e111-9065-000c29c342d9");
//myContact.Attributes.Add("customerid",t);
myContact.Attributes.Add("customerid", new EntityReference("account", new Guid("6ab5a492-7288-e111-9065-000c29c342d9")));
//myContact.Attributes.Add("awx_dealtype",1);
//myContact.Attributes.Add("awx_clientrole",1);
//myContact.Attributes.Add("awx_leadbrokerrole",1);
myContact.Attributes.Add("awx_dealtype", new OptionSetValue(1));
myContact.Attributes.Add("awx_clientrole", new OptionSetValue(1));
myContact.Attributes.Add("awx_leadbrokerrole", new OptionSetValue(1));
try{
service.Create(myContact);
}
catch(Exception ex)
{
}
}
- Edited by krunal89 Wednesday, May 02, 2012 5:25 PM
-
Thursday, May 03, 2012 10:34 AMhi anybody please help