I got an error when connecting the CRM 2013 from CRM SDK code. The error message is
An unsecured or incorrectly secured fault was received from the other party. See the inner FaultException for the fault code and detail.
And here is the inner exception message:
An error occurred when verifying security for the message.
The CRM is installed on Virtual Box that consist of:
- Windows Server 2012
- CRM 2013
- SQL Server 2012
- Timezone and datetime between Host and guest machine already the same
I have test the CRM connection with below scenario
- Able to access CRM from host browser (Windows 7)
- Able to run following code (CRM SDK) from guest machine (Win Server 2012)
- Not able to run following code from host machine (Windows 7)
Here is my source code:
var uri = new Uri(@"http://XXXX/MRC/XRMServices/2011/Organization.svc");
var username = @"XX\Administrator";
var password = "password";
_credential.UserName.UserName = username;
_credential.UserName.Password = password;
using (OrganizationServiceProxy serviceProxy = new OrganizationServiceProxy(uri, null, _credential, null))
{
serviceProxy.EnableProxyTypes();
IOrganizationService service = (IOrganizationService)serviceProxy;
MRServiceContext context = new MRServiceContext(service);
var query = context.ContactSet.ToList();
foreach (var item in query)
{
Console.WriteLine(item.FirstName);
}
}
Thanks in advance.