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)

Dynamics 365 Online Trial - Metadata contains a reference that cannot be resolved

(0) ShareShare
ReportReport
Posted on by

Hi,

I'm facing the below error while connecting to my Dynamics 365 Online Trial. I've gone through some of the solutions provided(e.g. updating to new SDK version etc), but none have helped, so posting this query here.

An exception of type 'System.InvalidOperationException' occurred in CRM Test Solution.dll but was not handled in user code
Metadata contains a reference that cannot be resolved: 'opsoftdec.api.crm8.dynamics.com/.../Organization.svc;sdkversion=8.2'.

The program '[2388] iisexpress.exe' has exited with code -1 (0xffffffff).

Following is my code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Microsoft.Xrm.Sdk;
using System.ServiceModel.Description;
using Microsoft.Xrm.Sdk.Client;
using System.Net;
using Microsoft.Xrm.Sdk.Query;

namespace CRM_Test_Solution
{
public partial class WebForm2 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
try
{
string _username = "username";
string _password = "password";
ClientCredentials credentials = new ClientCredentials();
credentials.UserName.UserName = _username;
credentials.UserName.Password = _password;
credentials.Windows.ClientCredential = CredentialCache.DefaultNetworkCredentials;
Uri organisationUri = new Uri("opsoftdec.api.crm8.dynamics.com/.../Organization.svc");
Uri homeRealmUri = null;

OrganizationServiceProxy serviceProxy = new OrganizationServiceProxy(organisationUri, homeRealmUri, credentials, null);
IOrganizationService service = serviceProxy;

}
catch (Exception ex)
{
throw ex;
}
}

*This post is locked for comments

I have the same question (0)
  • Alex Fun Wei Jie Profile Picture
    33,628 on at

    Hi,

    Dynamics 365 Online Trial is using V9.0, but your sdk version is V8.2

    Kindly remove the old reference and using Nuget to get the latest SDK

    For more information please refer here

  • naZir Profile Picture
    850 on at

    Update the Mocrosoft.Xrm.Sdk.dll file.

    Had same problem. Fixed it by using latest dll.

    Thank you

  • Community Member Profile Picture
    on at

    Thank you for your response, I've read through the thread you have suggested and have installed the latest versions of the packages suggested.

    PM> Install-Package Microsoft.CrmSdk.CoreAssemblies -Version 9.0.0.7

    Successfully installed 'Microsoft.CrmSdk.CoreAssemblies 9.0.0.7' to CRM Test Solution

    PM> Install-Package Microsoft.CrmSdk.Deployment -Version 9.0.0.7

    Successfully installed 'Microsoft.CrmSdk.Deployment 9.0.0.7' to CRM Test Solution

    PM> Install-Package Microsoft.CrmSdk.Workflow -Version 9.0.0.7

    Successfully installed 'Microsoft.CrmSdk.Workflow 9.0.0.7' to CRM Test Solution

    I had already installed Tooling V9.0.0.7 earlier to be able to connect via plugin registration tool.

    But I'm still facing the same error, anything else which I need to check?

    System.InvalidOperationException: 'Metadata contains a reference that cannot be resolved: 'opsoftdec.api.crm8.dynamics.com/.../Organization.svc;sdkversion=9'.'

    System.InvalidOperationException occurred
    HResult=0x80131509
    Message=Metadata contains a reference that cannot be resolved: 'opsoftdec.api.crm8.dynamics.com/.../Organization.svc;sdkversion=9'.
    Source=CRM Test Solution
    StackTrace:
    at CRM_Test_Solution.WebForm2.Page_Load(Object sender, EventArgs e) in C:\Users\LENOVO\source\repos\CRM Test Solution\CRM Test Solution\WebForm2.aspx.cs:line 36

    Inner Exception 1:
    WebException: The underlying connection was closed: An unexpected error occurred on a send.

    Inner Exception 2:
    IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.

    Inner Exception 3:
    SocketException: An existing connection was forcibly closed by the remote hos

  • Community Member Profile Picture
    on at

    Hi,

    I've downloaded the latest version of SDK from the below link:

    www.microsoft.com/.../details.aspx

    and used the Microsoft.Xrm.Sdk.dll received in this in the references.

    Is there any other latest version than than the one I mentioned above ?

  • Suggested answer
    Alex Fun Wei Jie Profile Picture
    33,628 on at

    Hi,

    can share the connection string  that you used to connect to CRM online?

    Remember change the password and username before you share here.

  • Community Member Profile Picture
    on at

    I've used the below  to connect with CRM:

    string _username = "username";

    string _password = "password";

    ClientCredentials credentials = new ClientCredentials();

    credentials.UserName.UserName = _username;

    credentials.UserName.Password = _password;

    credentials.Windows.ClientCredential = CredentialCache.DefaultNetworkCredentials;

    Uri organisationUri = new Uri("opsoftdec.api.crm8.dynamics.com/.../Organization.svc");

    Uri homeRealmUri = null;

    OrganizationServiceProxy serviceProxy = new OrganizationServiceProxy(organisationUri, homeRealmUri, credentials, null);

    IOrganizationService service = serviceProxy;

  • Suggested answer
    Alex Fun Wei Jie Profile Picture
    33,628 on at

    Hi,

    change your url into "opsoftdec.api.crm8.dynamics.com" . 

  • Community Member Profile Picture
    on at

    Hi,

    Sorry for the error in my previous reply regarding the URL.

    The URL in the code is already set using https://, as shown below, I had mentioned it incorrectly in my reply.

    Uri organisationUri = new Uri("opsoftdec.api.crm8.dynamics.com/.../Organization.svc");

                   Uri homeRealmUri = null;

  • Community Member Profile Picture
    on at

    ("opsoftdec.api.crm8.dynamics.com/.../Organization.svc");

                   Uri homeRealmUri = null;

  • Suggested answer
    Alex Fun Wei Jie Profile Picture
    33,628 on at

    Hi,

    Change your url into "opsoftdec.api.crm8.dynamics.com" without the /.../Organization.svc&quot

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