web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

IFD Connection

(0) ShareShare
ReportReport
Posted on by 205

Hello,

I am having some problems with the http://crmServer:5555/MSCRMServices/2007/SPLA/CrmDiscoveryService.asmx web service. When I go to the IIS where the WS is hosted and try to browse it, it shows an empty page (blank).

Then, as I have a IFD + OnPremise installation, and I have my custom ASPX web pages accessing the CrmService, DiscoveryService and MetadataService, I need to handle two different ways of authentication. I saw sdk's example and this is my code:

             string server = "http://<serverURL>"; //serverURL = localhost:5555 and I've tried with IP:5555 also


            // Initialize an instance of the CrmDiscoveryService Web service proxy.
            CrmDiscoveryService disco = new CrmDiscoveryService();
            disco.Url = server + "/MSCRMServices/2007/SPLA/CrmDiscoveryService.asmx";

            //Retrieve a list of available organizations.
            RetrieveOrganizationsRequest orgRequest =
                new RetrieveOrganizationsRequest();
            orgRequest.UserId = domain + "\\" + username;
            orgRequest.Password = password;
            RetrieveOrganizationsResponse orgResponse =
                (RetrieveOrganizationsResponse)disco.Execute(orgRequest);

            //Find the desired organization.
            foreach (OrganizationDetail orgdetail in orgResponse.OrganizationDetails)
            {
                if (orgdetail.OrganizationName == organizationName)
                {
                    //Retrieve the ticket.
                    RetrieveCrmTicketRequest ticketRequest =
                        new RetrieveCrmTicketRequest();
                    ticketRequest.OrganizationName = organizationName;
                    ticketRequest.UserId = domain + "\\" + username;
                    ticketRequest.Password = password;
                    RetrieveCrmTicketResponse ticketResponse =
                        (RetrieveCrmTicketResponse)disco.Execute(ticketRequest);

                    //Create the CrmService Web service proxy.
                    CrmAuthenticationToken sdktoken = new CrmAuthenticationToken();
                    sdktoken.AuthenticationType = 2;
                    sdktoken.OrganizationName = organizationName;
                    sdktoken.CrmTicket = ticketResponse.CrmTicket;

                    service = new CrmService();
                    service.CrmAuthenticationTokenValue = sdktoken;
                    service.Url = orgdetail.CrmServiceUrl;

                    break;
                }
            }

The application throws an exception when trying to execute the

            RetrieveOrganizationsResponse orgResponse =
                (RetrieveOrganizationsResponse)disco.Execute(orgRequest);

web method. Does anybody knows what could be the problem? I've seen a number of forums with similar questions but no one could help me. The exception is:

 "The request failed with HTTP status 401: Unauthorized."

"   at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)\r\n   at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)\r\n   at CRM.ServiceLayer.CRMDiscoveryService.CrmDiscoveryService.Execute(Request Request) in C:\\CRM\\CRM\\CRM.ServiceLayer\\Web References\\CRMDiscoveryService\\Reference.cs:line 79\r\n   at CRM.ServiceLayer.Service.ifdConnection(String organizationName) in C:\\CRM\\CRM\\CRM.ServiceLayer\\Service.cs:line 50\r\n   at CRM.ServiceLayer.Service..ctor(String organizationName, Boolean isIFD) in C:\\CRM\\CRM\\CRM.ServiceLayer\\Service.cs:line 29\r\n   at CRM.ServiceLayer.Vehiculos..ctor(String organizationName, Boolean isIFD) in C:\\CRM\\CRM\\CRM.ServiceLayer\\Vehiculos.cs:line 41\r\n   at CRM.VehiculosRelacionados.CargarEstados() in C:\\CRM\\CRM\\CRM\\VehiculosRelacionados.aspx.cs:line 561\r\n   at CRM.VehiculosRelacionados.Page_Load(Object sender, EventArgs e) in C:\\CRM\\CRM\\CRM\\VehiculosRelacionados.aspx.cs:line 112\r\n   at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e)\r\n   at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e)\r\n   at System.Web.UI.Control.OnLoad(EventArgs e)\r\n   at System.Web.UI.Control.LoadRecursive()\r\n   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)"

Any help will be appreciate. Thank you in advance,

Ale

*This post is locked for comments

I have the same question (0)
  • Alejandro Cesetti Profile Picture
    205 on at

     Hello again.

    I think I understand why this is not working and why the web service request (http://crmServer:5555/MSCRMServices/2007/SPLA/CrmDiscoveryService.asmx) returns a blank page. This is because I'm using IFD deployment but the custom aspx page is hosted in the same server as the CRM under the ISV folder.

    Ok, if this is correct, I have to use the CrmImpersonator class and create a token using the Page.Context and organization name. If this is also correct, I have a problem and is that I've done lots of custom pages and they all use Crm web services directly, I mean, I add the Web Reference to have the latest customizations and avoid using the DynamicEntity model. Now the thing is, if I don't misunderstand, that if there isn't a way to convert Crm web services type into SDK types and visceversa, I will have to use the DynamicEntity model. Am I right?

    Is there an easiest way to fix this? If not, is there a chance to work in a strongly type way with the DynamicEntitys?

    I hope you understand my concerns. Thank you all,

    Ale

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans