views:

768

answers:

1

I have created a SharePoint web part and inside this web part I am trying to consume a WCF service.To do so I have added the system.serviceModel node (copied from client app.config) into the web.config of my web application.

Is there any other way to do the same? Actually i am trying to avoid any modification in web.config of web application because MSDN says:

Changes that you make to Web.config may be overwritten when you install updates or service packs for Windows SharePoint Services, or when you upgrade an installation to the next product version.

+1  A: 

Why not write a feature that writes your web.config using the SharePoint API. Check out the link below to a question here on SO for more information.

By using the SharePoint object model you ensure that the changes are always made when rolling out your solution and then (de)activate the feature and you are sure that MS won't "break" your changes to the web.config (if it does just deactivate / activate the feature).

P.S. I have never had it happen that SharePoint broke muy web.config by deleting entries.

update-web-config-on-each-wfe-in-a-sharepoint-server-farm

Colin