Question

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.

Ref: https://stackoverflow.com/questions/352654/could-not-find-default-endpoint-element

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?

Thanks!!

Was it helpful?

Solution

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. 
webApp.WebConfigModifications.Add(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=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c' />";

Sample code taken from here

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top