I have a WCF Library Project that connects to SQL server and the connection string is stored in the App.config itself. I have a ASP.NET web site that hosts the svc file with reference to the WCF library project.
When I am building it on my PC I use the SQL Connection that is related to my PC, but now, when I am hosting I cannot edit the App.config file of WCF library because it is converted to DDL when published.
So, could you please tell me how I can manage the connection string for WCFlibrary project on a server and also on my building/debugging machine.
Thank you.
The connection string is stored inside the hosting application. If you have a WCF service running in IIS it would load it’s connection string from the web.config file, not from an app.config file.
If you then want to change the connectionstring between your development and production environment you can have a look at web.config transformations. The transformations allow you to define different settings (like connection string) that will be automatically applied when you publish the website.