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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Getting error while connection on-premises crm 2016.

(0) ShareShare
ReportReport
Posted on by

Hello team,

I am getting error while connecting crm on-premise server.

0624.Error.png

Source : System.ServiceModel
Method : Retrieve
Date : 8/18/2016
Time : 12:51:46 AM
Error : Metadata contains a reference that cannot be resolved: '192.168.1.243/.../Discovery.svc;sdkversion=8.1'.
Stack Trace : at System.ServiceModel.Description.MetadataExchangeClient.MetadataRetriever.Retrieve(TimeoutHelper timeoutHelper)
at System.ServiceModel.Description.MetadataExchangeClient.ResolveNext(ResolveCallState resolveCallState)
at System.ServiceModel.Description.MetadataExchangeClient.GetMetadata(MetadataRetriever retriever)
at System.ServiceModel.Description.MetadataExchangeClient.GetMetadata(Uri address, MetadataExchangeClientMode mode)
at Microsoft.Xrm.Sdk.Client.ServiceMetadataUtility.RetrieveServiceEndpointMetadata(Type contractType, Uri serviceUri, Boolean checkForSecondary)
at Microsoft.Xrm.Sdk.Client.ServiceConfiguration`1..ctor(Uri serviceUri, Boolean checkForSecondary)
at Microsoft.Xrm.Sdk.Client.ServiceConfigurationFactory.CreateManagement[TService](Uri serviceUri, Boolean enableProxyTypes, Assembly assembly)
at Microsoft.Xrm.Sdk.Client.ServiceConfigurationFactory.CreateManagement[TService](Uri serviceUri)
at Microsoft.Xrm.Tooling.Connector.CrmWebSvc.CreateAndAuthenticateProxy[T](IServiceManagement`1 servicecfg, Uri ServiceUri, Uri homeRealm, ClientCredentials userCredentials, ClientCredentials deviceCredentials, String LogString)
at Microsoft.Xrm.Tooling.Connector.CrmWebSvc.DiscoverOrganizations(Uri discoveryServiceUri, Uri homeRealmUri, ClientCredentials clientCredentials, ClientCredentials deviceCredentials)
at Microsoft.Xrm.Tooling.Connector.CrmWebSvc.DiscoverOrganizations(Uri discoveryServiceUri, Uri homeRealmUri, NetworkCredential networkCredential)
at Microsoft.Xrm.Tooling.Connector.CrmServiceClient.DiscoverOrganizations(Uri discoveryServiceUri, Uri homeRealmUri, NetworkCredential networkCredential)
at Microsoft.Xrm.Tooling.CrmConnectControl.CrmConnectionManager.ValidateServerConnection(CrmOrgByServer selectedOrg)
======================================================================================================================
Inner Exception Level 1 :
Source : System
Method : GetResponse
Date : 8/18/2016
Time : 12:51:46 AM
Error : The remote server returned an error: (404) Not Found.
Stack Trace : at System.Net.HttpWebRequest.GetResponse()
at System.ServiceModel.Description.MetadataExchangeClient.MetadataLocationRetriever.DownloadMetadata(TimeoutHelper timeoutHelper)
at System.ServiceModel.Description.MetadataExchangeClient.MetadataRetriever.Retrieve(TimeoutHelper timeoutHelper)
======================================================================================================================

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    a33ik Profile Picture
    84,331 Most Valuable Professional on at

    Hello,

    It looks that your CRM uses AD authentication so it would be correct to use following approach to passing of credentials:

    ClientCredentials credentials = new ClientCredentials();

    credentials.Windows.ClientCredential = new NetworkCredential("administrator", "p@ssw0rd", "nqcrm");

    instead of yours.

  • Community Member Profile Picture
    on at

    Thanks for help,

    I tried provide solution, but still getting same error.

    please find my below code.

    using Microsoft.Crm.Sdk.Messages;

    using Microsoft.Xrm.Sdk;

    using Microsoft.Xrm.Sdk.Client;

    using System;

    using System.Collections.Generic;

    using System.Linq;

    using System.Net;

    using System.ServiceModel.Description;

    using System.Text;

    using System.Threading.Tasks;

    namespace CRM_2016_Console

    {

       class Program

       {

           static IOrganizationService _service;

           static void Main(string[] args)

           {

               ConnectToMSCRM("nqcrm\\Administrator", "p@ssw0rd", "win-md5unq8a36p/.../Organization.svc");

               Guid userid = ((WhoAmIResponse)_service.Execute(new WhoAmIRequest())).UserId;

               if (userid != Guid.Empty)

               {

                   Console.WriteLine("Connection Established Successfully");

                   Console.ReadKey();

               }

           }

           public static void ConnectToMSCRM(string UserName, string Password, string SoapOrgServiceUri)

           {

               try

               {

                   ClientCredentials credentials = new ClientCredentials();

                   credentials.Windows.ClientCredential = new NetworkCredential("administrator", "p@ssw0rd", "nqcrm");

                   //credentials.UserName.UserName = UserName;

                   //credentials.UserName.Password = Password;

                   Uri serviceUri = new Uri(SoapOrgServiceUri);

                   OrganizationServiceProxy proxy = new OrganizationServiceProxy(serviceUri, null, credentials, null);

                   proxy.EnableProxyTypes();

                   _service = (IOrganizationService)proxy;

               }

               catch (Exception ex)

               {

                   Console.WriteLine("Error while connecting to CRM " + ex.Message);

                   Console.ReadKey();

               }

           }

       }

    }

  • Alagunellaikumar Profile Picture
    6,212 on at

    Try this below 

    credentials = new ClientCredentials();

    credentials.Windows.ClientCredential = new System.Net.NetworkCredential("username","password", "Domain");

  • a33ik Profile Picture
    84,331 Most Valuable Professional on at

    That's weird.

    Can you ping this address - 192.168.1.243 from cmd?

  • Alagunellaikumar Profile Picture
    6,212 on at

    Remove below two lines

    proxy.EnableProxyTypes();

    _service = (IOrganizationService)proxy;

    use directly with proxy.Execute

  • Community Member Profile Picture
    on at

    still facing same problem

  • Community Member Profile Picture
    on at

    1104.Error2.png

    public static void ConnectToMSCRM(string UserName, string Password, string SoapOrgServiceUri)
    {
    try
    {
    ClientCredentials credentials = new ClientCredentials();
    credentials.Windows.ClientCredential =new System.Net.NetworkCredential("administrator", "p@ssw0rd", "nqcrm");
    //credentials.UserName.UserName = UserName;
    //credentials.UserName.Password = Password;
    Uri serviceUri = new Uri(SoapOrgServiceUri);
    OrganizationServiceProxy proxy = new OrganizationServiceProxy(serviceUri, null, credentials, null);
    //proxy.EnableProxyTypes();
    // _service = (IOrganizationService)proxy;
    var id = proxy.Execute(new WhoAmIRequest());
    }
    catch (Exception ex)
    {
    Console.WriteLine("Error while connecting to CRM " + ex.Message);
    Console.ReadKey();
    }
    }

  • Alagunellaikumar Profile Picture
    6,212 on at

    Type .svc URL in browser and give your credentials and check whether WSDL file is generated

  • Community Member Profile Picture
    on at

    yes it is generated.

  • Alagunellaikumar Profile Picture
    6,212 on at

    Try to execute query expression in the _service.Execute(queryExpression)

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans