401 error if I connect from my ASP.NET app. to CrmDiscoveryService.asmx (CRM 2011) RRS feed

  • Question

  • I have to use CrmDiscoveryService.asmx for DYNAMICS CRM 2011 because of the compatability to CRM 4.0. I impemented IFD authentification algorithm and now it doesnt works:

    I can connect me successfully to CrmDiscoveryService.asmx from Browser (anonymous connection enabled)
    URL: https://internalcrm.organme.com:444/mscrmservices/2007/spla/crmdiscoveryservice.asmx

    But if I try to get connected with the same URL from ASP.NET - i receive 401 error.

    RetrieveCrmTicketRequest crmTicketRequest = new RetrieveCrmTicketRequest();
    crmTicketRequest.OrganizationName = OrgUniqueName; crmTicketRequest.UserId = "bnet"+"\\"+"izz"; crmTicketRequest.Password = "pass"; CrmDiscoveryService discoveryService = serviceHandler.CreateCrmDiscoveryService(crmDiscoveryServiceUrl); discoveryService.UseDefaultCredentials = true; RetrieveCrmTicketResponse crmTicketResponse = (RetrieveCrmTicketResponse)discoveryService.Execute(crmTicketRequest); //Trust all certificates System.Net.ServicePointManager.ServerCertificateValidationCallback = ((sender, certificate, chain, sslPolicyErrors) => true);

    Tuesday, May 8, 2012 7:30 AM