How to work with connectionStrings configSource attribute

I am trying to use the webconfig / appconfig “configSource” and “file” attributes respectively, to allow custom, per-developer-and-not-version-controlled settings. I currently use this approach in a day-job MS WebApi2 project, and am trying to replicate in SS.

However, when I try to path to a private setting file in the web.config connstrings tag, eg:

connectionStrings configSource=“…/…/ConnectionStrings.Private.config”

(based on ASP.NET MVC: Keep Private Settings Out of Source Control | John Atten )

I get the error “ConfigurationErrorsException: The configSource attribute must be a relative physical path, so the ‘/’ character is not allowed.”

This error message appears to be coming outside of ServiceStack, but its strange because as mentioned I am currently using a relative path just like this in a WebApi2 project does ServiceStack AppSettings not support the use of custom config files?

The code I am trying is publicly available:

https://github.com/daleholborow/iayos.core.db.deploy

and specifically, run the iayos.core.db.deploy.TEST project, after having created a private file called “ConnectionStrings.Private.config” in the project folder.

Any ideas?

You’re dealing with .NET’s config system, this has nothing to do with ServiceStack, we proactively try to avoid using web.config constructs and prefer using our clean AppSettings providers instead.

1 Like