Error Creating WCF Connection for BCS Content Type in SharePoint Online

***some links Currently Broken***

I started this week's Super SharePoint Detective Adventure while trying to follow Nick
Swan's blog article about creating a BCS External Content Type for CRM 2011. This kind of integration between SharePoint and CRM is something I've been wanting to prove out for our own use for a long time now, and Nick's approach (although it still involves a lot of "glue code") seems like the most reasonable one I've seen to date.

True, his article talks about SharePoint 2010, but he has another one based on 2013 and all the concepts look like they ought to be backward compatible. In fact, everything was going fairly well, until I got to the last step in SharePoint Designer where you actually create the ECT connected to your WCF service. Then, things just wouldn't work - no matter what I tried, SharePoint Designer kept giving me this error.

  • An error occurred while accessing WCF service URL: http://<myStagingGuid>.cloudapp.net/BcsTest.svc
  • Connection to the WCF service that has connection name BcsTest cannot be established.
    • Unknown Error occurred. Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.


I could see others online are having this problem too, as there are questions about it posted in a few places, but mysteriously so far there was no answer:

  • MS Forums: Problem creating external content type from WCF service
  • Stack Overflow: Consume WCF Service in Office365 from window Azure


So, I did some experimentation. People say this works in on premises SharePoint, so I point
SPD at my on-prem SharePoint 2013 farm, and just as they say everything works fine.

Maybe my types are too complex. After all I am trying to pull a ton of data fields from a CRM Account. I create a much smaller web service with a data structure containing just a string with "Hello world!" and an integer ID of 1234. Still, I cannot create the data connection to this service either.

I spend some time trying to package up my data model into a *.bdcm file, and then do the export from my on-prem farm to SPO. No dice! This just breaks differently, because now when I go back to SP Designer my data connections are still broken, and my options from the SharePoint web UI are too limited to complete the configuration.

After beating my head against the wall all Friday evening - then stressing out all weekend about how I'm supposed to get a good hybrid solution with one part in the cloud and one part on our local network when I can't get the in the cloud part of it to work - I decided to open a ticket with support. At this point, I am not expecting great things to happen.

I guess it's a good thing that my experience did not live up to my expectations. I got the answer that I needed, and I didn't even have to wait a fortnight!

Update: Yay! Microsoft releases official KB article for my issue. KB2879695: Unknown Error occurred" error message when you try to create an External Content Type in SharePoint Online by using SharePoint Designer 2013 came out yeterday; interesting timing, indeed. ;-)

I was also surprised when I learned the cause to this problem, and its solution - or at least the workaround. More on the cause in a moment. I think it may surprise you. Here's the workaround for you, in glorious Technicolor.

  1. Find the spdesigner.exe.config file. In my case this was in C:\Program Files\Microsoft Office\Office15 because I am using the 64 bit version. You're all using 64 bit now right? Right?
  2. Make a backup of this file, because you never know when you'll want to reverse this fix, like maybe on whatever day SharePoint 2016 finally rolls out.
  3. Add the runtime element below, so that your file looks like the following code, then save it.

    And that's it. Just re-execute SharePoint Designer and it will magically work.

So what's going on here? Bascially, we're telling SPD that if it gets a reference to a version
16.* assembly, it should use version 15.0.0.0 instead. Seems that the Office 365 team has incremented the version number for SharePoint online to 16.0.0.0 for some reason. That's why the BCS connection will work fine if you are pointing to your on premises SharePoint farm.

Do they have a time machine into the not-so-distant future? Are they pilot testing the super-secret-squirrel beta version? Was somebody just a very bad typist working with an equally bad set of software testers? As Fox Moulder once said, "The truth is out there." But it turns out that it really isn't so exciting. I'm told that the reason this was done is to help differentiate the build running in Office 365 from the on premises version.

I'll defer judgment for now on whether this was a particularly wise decision on Microsoft's part, but I encourage you to leave your opinions in the comments. Let's just say that heir workaround has had some unintended consequences, and my error was one of those.

And of course, if you think this was a particularly brilliant piece of detective work and want us to help on your next SharePoint project, you can reach me here.

Further reading / related articles:

 

**Moved over old comments for this blog***