When creating a new service in a WCF service project, Visual Studio will automatically put configuration information into the service’s web.config file. Is there anyway to replicate this behavior with a new web config file and an existing service class in a service project? Sometimes the service’s web.config seems to get mangled up either through user error or visual studio quirks. It would be nice to delete the service’s web.config and get a fresh one that is auto configured using the same default configuration as if a new service class were created in VS.
Is there anyway to accomplish this?
EDIT: I’m referring to the service’s web.config file not the client web.config/app.config.
Sure – you can run the command-line utility
svcutil.exeagainst your service (directly using the URL or the WSDL as a file). This will by default generate aoutput.configconfig file which contains all the necessary settings in the<system.serviceModel>section. Just copy & paste into your new or existing web.config.Marc
EDIT: From comments below, the answer is no in the case of the server side config.