Firi
Firi
RRailway
Created by Firi on 8/21/2023 in #✋|help
Relative path issue
I am trying to read some Json files and parse them with one of my services. Locally it works fine. I've tried 3 different methods of determining the path and all of them have the same path issue So here is my deployment log message
Error reading JSON file: Could not find file '/app/wwwroot/json/homecoming/boost_sets/Unbreakable_Guard.json'.

Error reading JSON file: Could not find file '/app/wwwroot/json/homecoming/boost_sets/Unbreakable_Guard.json'.

Error reading JSON file: Could not find file '/app/wwwroot/json/homecoming/boost_sets/Unbreakable_Guard.json'.

Error reading JSON file: Could not find file '/app/wwwroot/json/homecoming/boost_sets/Unbreakable_Guard.json'.

Error reading JSON file: Could not find file '/app/wwwroot/json/homecoming/boost_sets/Gladiators_Armor.json'.
Error reading JSON file: Could not find file '/app/wwwroot/json/homecoming/boost_sets/Unbreakable_Guard.json'.

Error reading JSON file: Could not find file '/app/wwwroot/json/homecoming/boost_sets/Unbreakable_Guard.json'.

Error reading JSON file: Could not find file '/app/wwwroot/json/homecoming/boost_sets/Unbreakable_Guard.json'.

Error reading JSON file: Could not find file '/app/wwwroot/json/homecoming/boost_sets/Unbreakable_Guard.json'.

Error reading JSON file: Could not find file '/app/wwwroot/json/homecoming/boost_sets/Gladiators_Armor.json'.
here is my path creation that works locally in dev mode string jsonFilePath = Path.Combine("wwwroot", "json", "homecoming", "boost_sets", $"{enhancementName}.json"); string jsonFilePath = "wwwroot/json/homecoming/boost_sets/" + enhancementName + ".json"; string webRootPath = _env.WebRootPath; string jsonFilePath = Path.Combine(webRootPath, "json", "homecoming", "boost_sets", $"{enhancementName}.json"); All three above work locally just fine and all 3 give me the same error when deployed
22 replies