Archive

Posts Tagged ‘IFD’

CRM 4: IFD Authentication using C#

April 14th, 2010

A very common question is: “How do i run a plugin/custom web application against a IFD deployment?”

You should use the below code:

CrmDiscoveryService disco = new CrmDiscoveryService();
disco.Url = "https://YOUR.IFD.URL/MSCRMServices/2007/SPLA/CrmDiscoveryService.asmx";
RetrieveOrganizationsRequest orgRequest = new RetrieveOrganizationsRequest();
orgRequest.UserId = @"username";
orgRequest.Password = "password";
RetrieveOrganizationsResponse orgResponse = (RetrieveOrganizationsResponse)disco.Execute(orgRequest);
OrganizationDetail orgInfo = null;
foreach (OrganizationDetail orgdetail in orgResponse.OrganizationDetails)
{
   if (orgdetail.OrganizationName.Equals("OrgName"))
   {
   orgInfo = orgdetail;
   break;
   }
}
if (orgInfo == null)
{
   throw new Exception("The specified organization was not found.");
}
RetrieveCrmTicketRequest ticketRequest = new RetrieveCrmTicketRequest();
ticketRequest.OrganizationName = orgInfo.OrganizationName;
ticketRequest.UserId = @"username";
ticketRequest.Password = "password";
RetrieveCrmTicketResponse ticketResponse = (RetrieveCrmTicketResponse)disco.Execute(ticketRequest);

CrmAuthenticationToken sdktoken = new CrmAuthenticationToken();
sdktoken.AuthenticationType = 2;
sdktoken.OrganizationName = orgInfo.OrganizationName;
sdktoken.CrmTicket = ticketResponse.CrmTicket;
CrmService service = new CrmService();
service.CrmAuthenticationTokenValue = sdktoken;
service.Url = orgInfo.CrmServiceUrl;

Code: ifd-service-auth-code.txt

MSCRM-Admin CRM 4.0, Plug-ins , , ,

CRM 4.0 - Server Error in ‘/’ Application

June 28th, 2009

Gday all,

We had recently powered off our CRM 4.0 server (IFD deployment) due to some urgent maintenance.

We powered on the server, waited for it load and then tried to login and got the wonderful ASP .Net error “Server Error in ‘/’ Application” - i though crap.. what’s going on here..

Looked through the event log and found the ASP .Net exception and it said something about the ASYNC service not running or responding..

I quickly started the services management console and saw that the Microsoft CRM Async Service wasn’t started event though it’s in automatic startup mode..

I started the service and issued an ‘IISRESET’ and everything was back to normal.

Something strange is going on and i will have to investigate..

MSCRM-Admin CRM 4.0 , , , , ,