Mysterious error: Metadata contains a reference that cannot be resolved. ‘https:///XRMServices/2011/Organization.svc?wsdl&sdkversion= ‘

We built a console app which do the automation of importing flat files of entities into CRM Online. The app is run by a scheduled task in a on-premise VM server. Everything was working fine until recently, the client told us they didn’t see their data imported in CRM for a few days and it held up their work.

I started investingating by looking into the log file and there were multiple lines of following error:

Metadata contains a reference that cannot be resolved. ‘https:///XRMServices/2011/Organization.svc?wsdl&sdkversion=

At first glance, I thought that might be because of metadata/schema had been changed and the code was out of date. But it wasn’t the case.

I knew the error was from CRM exception so I searched it to see if anyone has the same issue. There are many results and they have the same answer telling to update the code to use the latest SDK. I did try but no luck. The job still failed with the same error every time it was triggered.

I built another app with just a simple WhoAmIRequest to test if I get the same error. But my app worked. Then I tried to run the task manually, it worked this time. So the code was still OK. Weird. So I thought it might be the network connection.

I disabled the Internet adapter, tried running my app again and, magically, I got the error. So it was because of network connection. I doubted it might be because of the client server. The CRM server was not likely because the task failed for a few day consecutively, and I don’t think it will happen for Microsoft.

So it might be 1) The server had internet connection issue. 2) There was a change in the client’s network policy (proxy or firewall), but they said they didn’t change anything. Only 1) left. But I wouldn’t be able to RDP to the server if there was a internet connection issue. It got frustrating now. Then something strange happened.

When I was remoting to the server, I saw the scheduled task failed, then I tried to run the task manually, it also failed. I tried to my simple app, it worked. And I tried the task again, it worked now and for many times I tried again. “What is going on?”, I said to myself. I decided to let it run and check again the next day.

The next day it still failed. I thought of a case when the server is idle for a long time, it loses connection. I searched for it and someone told to check the power options in windows, also uncheck the below adapter setting. I did it and let the server idle for a few hours.


When I tried to run the task again, it still failed. I was getting to a dead end. In the server, I opened Chrome, tried to log in to CRM to check connection. It loaded. Then I tried the task again, it worked. “Why?”. Looks like it works every time after I try to connect to the internet using something else other than the task, a browser and my simple app as I did. But I still wondered why.

I tried checking the proxy settings and saw that the proxy was applied using a script. So might be the .Net console app didn’t apply the system proxy settings. I searched for it and what I need to do was to add a configuration:

<defaultProxy useDefaultCredentials="true" >

Right after I added the config and tried again, it worked. I kept monitoring it when the task was triggered by the scheduler for a few times. And it seems to be working fine now.

Phew! What an experience! Still, I’m not sure why it works after there is an internet traffic. I’ll update it here if I happen to find out. Sorry for a long post!

Let’s gain more EXP!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s