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 Microsoft Employee

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

  • ReallyDeepBlue Profile Picture
    ReallyDeepBlue 20 on at
    RE: Dynamics 365 Online Trial - Metadata contains a reference that cannot be resolved

    What version of .NET is your project running in?

    MS recently required the use of TLS 1.2 or later so you will need to run .NET 4.6.2 or later

    blogs.msdn.microsoft.com/.../updates-coming-to-dynamics-365-customer-engagement-connection-security

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Dynamics 365 Online Trial - Metadata contains a reference that cannot be resolved

    Hi,

    please refer to the following two links:

    rajeevpentyala.com/.../dynamics-365-plug-in-registration-tool-connectivity-issues

    www.mscrm.com/.../dynamics-crm-v9-d365-connection-error.html

    Thanks.

    venkateswarlu

  • Alex Fun Wei Jie Profile Picture
    Alex Fun Wei Jie 33,626 on at
    RE: Dynamics 365 Online Trial - Metadata contains a reference that cannot be resolved

    Hi,

    then i think you don't have any other choice, but change it to the method suggested by Pawel Gradecki.

  • naZir Profile Picture
    naZir 850 on at
    RE: Dynamics 365 Online Trial - Metadata contains a reference that cannot be resolved

    hey.. There is one more think.. Check your network proxy. Same issue.. I was having. I added some code in web.config file to bypass the network issue.

    <system.net>

       <defaultProxy useDefaultCredentials="true" enabled="true">

    </defaultProxy>

     </system.net>

    Add this to your solution in web.config after </syestem.web>

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Dynamics 365 Online Trial - Metadata contains a reference that cannot be resolved

    Hi,

    Appreciate your help.

    I tried with "https://opsoftdec.api.crm8.dynamics.com&quot;, but its resulting in the same error

  • Suggested answer
    tw0sh3ds Profile Picture
    tw0sh3ds 5,600 on at
    RE: Dynamics 365 Online Trial - Metadata contains a reference that cannot be resolved

    Your way of connecting to Dynamics 365 is very outdated, I'm not sure where did you find your code but since few years there are much better ways of connecting. You should connect using Xrm.Tooling assembly. Here you will find the example:

    [View:https://msdn.microsoft.com/pl-pl/library/jj602970.aspx:750:50]

    Or:

    https://msdn.microsoft.com/en-us/library/dn688177.aspx

    The only part you need is this one:

    CrmServiceClient conn = new Xrm.Tooling.Connector.CrmServiceClient(connectionString);


    And of course you should build correctly your connection string (as you are using Online, it should be the one for Office 365) or use some other constructor of CrmServiceClient which does not require Connection String

  • Suggested answer
    Alex Fun Wei Jie Profile Picture
    Alex Fun Wei Jie 33,626 on at
    RE: Dynamics 365 Online Trial - Metadata contains a reference that cannot be resolved

    Hi,

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

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Dynamics 365 Online Trial - Metadata contains a reference that cannot be resolved

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

                   Uri homeRealmUri = null;

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Dynamics 365 Online Trial - Metadata contains a reference that cannot be resolved

    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&quot;);

                   Uri homeRealmUri = null;

  • Suggested answer
    Alex Fun Wei Jie Profile Picture
    Alex Fun Wei Jie 33,626 on at
    RE: Dynamics 365 Online Trial - Metadata contains a reference that cannot be resolved

    Hi,

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

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

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Tip: Become a User Group leader!

Join the ranks of valued community UG leaders

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,516 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,387 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans