I have a SharePoint web part which uses a WCF service. To be able to consume the web service in my web part, I need to modify the SharePoint web.config to include bindings and end points.
What's the best way to do this?
I have a SharePoint web part which uses a WCF service. To be able to consume the web service in my web part, I need to modify the SharePoint web.config to include bindings and end points.
What's the best way to do this?
This was very useful but it missed a bit. Whereas the code can be deployed, it can't be retracted because a name wasn't assigned.
Use:
Also, having said that this is bindings, you (probably) can't still can't apply the settings if there are already settings there for:
... inside the
system.serviceModel
I've used the technique to insert the bindings and then the client end point gets inserted separately as this can change according to installation and in my case is set via a sharepoint list entry.
To be able to do this, I put my web service configuration into a text file as a template. The text file (BindingTemplate.txt) content is as the following:
I used the C# following code to modify the web.config:
I spent some time figuring it out. Hope this will help someone.