Basically |DataDirectory|
is an alias for App_Data
folder. Since you are not using App_Data
in your services project, it would not help you in this situation.
What you can do though is try starting from the project root using ~\
:
AttachDbFilename=~\..\ProjectName\App_Data\database.mdf
Also there is always an option to use an absolute path:
AttachDbFilename=d:\Projects\ProjectName\App_Data\database.mdf
And finally there is always an option to build connection string programmatically.