When i tried to consume the online crm services (https://orgnameapi.crm8.dynamics.com/XRMServices/2011/Organization.svc?wsdl)
in my console application for crud operation.But i keep getting an error -"An error occurred when verifying security for the message".
i have searched for the error it may be because of the time zone,but i did tried to change the time zone of my crm & pc but still not working.any idea on this one.
code:
String strURI = "https://orgname.api.crm8.dynamics.com/XRMServices/2011/Organization.svc";
try
{
OrganizationServiceClient client = new OrganizationServiceClient();
client.ClientCredentials.Windows.ClientCredential = new System.Net.NetworkCredential("username", "password", "https://orgname.crm8.dynamics.com");
System.ServiceModel.EndpointAddress myEndpointAdd = new System.ServiceModel.EndpointAddress(new Uri(strURI), System.ServiceModel.EndpointIdentity.CreateDnsIdentity(""));
client.Endpoint.Address = myEndpointAdd;
Entity t = new Entity();
t.LogicalName = "Account";
AttributeCollection myAttColl = new AttributeCollection();
myAttColl.Add(new KeyValuePair<string, object>("name", "test from console"));
t.Attributes = myAttColl;
client.Create(t);
Console.ReadLine();
client.Close();
} catch (Exception e) { Console.WriteLine(e.Message); }