CRM 2011 SecurityNegotiationException trying to access web services

一笑奈何 提交于 2019-12-06 05:26:15
Sidharth

I found the solution. First of all please download the RTW release of CRM SDK 2011.

Code for connectivity will be :

public static IOrganizationService Service() 
{
    ClientCredentials Credentials = new ClientCredentials(); 
    Credentials.Windows.ClientCredential.UserName ="<username>"; 
    Credentials.Windows.ClientCredential.Password ="<password>"; 

    //This URL needs to be updated to match the servername and Organization for the environment.
    Uri OrganizationUri = new Uri("http://<server name>/<organization name>/XRMServices/2011/Organization.svc"); 
    Uri HomeRealmUri = null; 

    //OrganizationServiceProxy serviceProxy; 
    using (OrganizationServiceProxy serviceProxy = new OrganizationServiceProxy(OrganizationUri, HomeRealmUri, Credentials, null)) 
    {
        IOrganizationService service = (IOrganizationService)serviceProxy; 
        return service; 
    }
}

and here you go...

Cheers! Enjoy coding.

lafe

You might want to narrow down the exact error in CRM by using the CRM trace. You can activate the CRM trace with a dedicated tool and search it for more detailed information about the source of the exception. Note that the trace files get very big very fast, so it is reasonable to trace only during the webservice call.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!