0

CRM 4.0 との互換性のため、DYNAMICS CRM 2011 には CrmDiscoveryService.asmx を使用する必要があります。IFD認証アルゴリズムを実装しましたが、機能しません:

ブラウザから CrmDiscoveryService.asmx に正常に接続できます (匿名接続が有効) URL: https://internalcrm.organme>.com:444/mscrmservices/2007/spla/crmdiscoveryservice.asmx

しかし、ASP.NET から同じ URL に接続しようとすると、401 エラーが発生します。コード:

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);
4

2 に答える 2

0

CrmDiscoveryService Webサービスの使用:IFDのサンプルのように、利用可能な組織のリストを取得することから始めるのは理にかなっているかもしれません。

// Configure an instance of the CrmDiscoveryService Web service proxy.
CrmDiscoveryService disco = new CrmDiscoveryService();
disco.Url = "https://localhost/MSCRMServices/2007/SPLA/CrmDiscoveryService.asmx";

//Retrieve a list of available organizations from the CrmDiscoveryService Web service.
RetrieveOrganizationsRequest orgRequest = new RetrieveOrganizationsRequest();
// Substitute an appropriate domain, username, and password here.
orgRequest.UserId = domain + "\\" + username;
orgRequest.Password = password;
RetrieveOrganizationsResponse orgResponse = (RetrieveOrganizationsResponse)disco.Execute(orgRequest);

//Find the target organization.
OrganizationDetail orgInfo = null;

foreach (OrganizationDetail orgdetail in orgResponse.OrganizationDetails)
{
    if (orgdetail.OrganizationName.Equals("AdventureWorksCycle"))
    {
        orgInfo = orgdetail;
        break;
    }
}

// Check whether a matching organization was not found. 
if (orgInfo == null)
    throw new Exception("The specified organization was not found.");

//Retrieve a CrmTicket from the CrmDiscoveryService Web service.
RetrieveCrmTicketRequest ticketRequest = new RetrieveCrmTicketRequest();
ticketRequest.OrganizationName = orgInfo.OrganizationName;
ticketRequest.UserId = domain + "\\" + username;
ticketRequest.Password = password;
RetrieveCrmTicketResponse ticketResponse =
    (RetrieveCrmTicketResponse)disco.Execute(ticketRequest);
于 2012-05-08T08:30:12.280 に答える
0

paramosh が言っていたように、検出サービスにも資格情報を設定してみてください。

discoveryService.Credentials = new System.Net.NetworkCredential("izz", "password", "bnet");

于 2012-05-08T13:36:43.033 に答える