How to use |DataDirectory| substitution string in appsettings.json with asp.net core?
问题 I'm new to asp.net core and the task I want to do should be very simple. Using Visual Studio, I'm trying to link a .mdf file to my project as a local database. As I want to make it work for several computers, I need to find the data directory folder path from appsettings.json. Therefore, after some researches, the best way to do that is using the |DataDirectory| substitution string. The problem is that my website can't reach my mdf file this way and it generates an ArgumentException :