RE: WS-Trust Authentication Error
Hi,
You need to use below code to connect to CRM
public IOrganizationService createConnection()
{
try
{
CrmServiceClient crmSvc = new CrmServiceClient(ConfigurationManager.ConnectionStrings["MyCDSServer"].ConnectionString);
if (crmSvc.IsReady)
{
return crmSvc ;
}
else
{
Console.WriteLine("Error:"+crmSvc .LastCrmError);
return null;
}
}
catch (Exception ex)
{
// Console.WriteLine("Exception caught - " + ex.Message); //TTC_KH_ConsoleComment
}
return null;
}
<connectionStrings>
<add name="MyCDSServer" connectionString="AuthType=OAuth;Username=;Password=;Url=;AppId=51f81489-12ee-4a9e-aaae-a2591f45987d;RedirectUri=app://58145B91-0C36-4500-8554-080854F2AC97;LoginPrompt=Auto" />
</connectionStrings>
Add Username and password.
You will need to add below package from nuget manager -
www.nuget.org/.../
xrmdynamicscrm.wordpress.com/.../
Please mark my answer verified if this is helpful!
Regards,
Bipin Kumar
Follow my Blog: xrmdynamicscrm.wordpress.com/