SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a 'Custom Connector' sits in GAC, that calls a WCF. I have External Content Type (BDC Model) uses this custom connector.

I'm getting an error: Could not find default endpoint element that references contract 'DataManager.IDataManagerService' in the ServiceModel client configuration section. This might be because no configuration file was found for your application, or because no endpoint element matching this contract could be found in the client element.

Solution: "This error can arise if you are calling the service in a class library and calling the class library from another project." In this case you will need to include the WS configuration settings into the main projects app.config if its a winapp or web.config if its a web app. This is the way to go even with PRISM and WPF/Silverlight.


So I need to copy the system.serviceModel into SP's web.config

I know there are quite a few config files in SP, anyone know which one I'm modifying?

Another question I have is: if there's any changes in the web.config, I will always have to remember to copy it into SP's config file. Is there a solution for this to keep them in sync?


share|improve this question
up vote 0 down vote accepted

You should put your configuration attributes in the web.config located at C:\inetpub\wwwroot\wss\VirtualDirectories and choose the folder of your Web Application.

By the other hand you can use the class SPWebConfigModification to make changes in the web.config file programmatically

SPWebConfigModification modification = new SPWebConfigModification("CustomURLRewrite", "configuration/configSections");
modification.Owner = "SimpleSampleUniqueOwnerValue";
modification.Sequence = 0;
modification.Type = SPWebConfigModification.SPWebConfigModificationType.EnsureChildNode;
modification.Value = "<sectionGroup name='CustomURLRewrite'>sectionGroup>";

// Add my new web.config modification. 

SPWebConfigModification modification1 = new SPWebConfigModification("CustomURLRewrite", "configuration/configSections/sectionGroup[@name='CustomURLRewrite']");
modification1.Owner = "SimpleSampleUniqueOwnerValue";
modification1.Sequence = 1;
modification1.Type = SPWebConfigModification.SPWebConfigModificationType.EnsureChildNode;
modification1.Value = "<section name='navdeep' type='Microsoft.SharePoint.ApplicationRuntime.SafeControlsConfigurationHandler, Microsoft.SharePoint, Version=, Culture=neutral, PublicKeyToken=71e9bce111e9429c' />";

Sample code taken from here

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.