Thursday, April 5, 2018

How to traverse file structure in deployed Azure app?

So, I have a multiproject application I'm struggling on deploying to Azure.

I have a Seed.cs file in my .Data project that uses a .json file in the project to seed the database. In development, this is what I was using to access the file and it worked fine:

var userData = System.IO.File.ReadAllText("../EFConnect.Data/UserSeedData.json"); 

In the Startup.cs file in the .API project I'm registering the Seed class as Transient in ConfigureServices() and calling it in the Configure() method.

However, when I deploy it - I get this error: Could not find a part of the path 'D:\home\site\wwwroot\EFConnect.Data\UserSeedData.json'

I've tried different combinations of pathing and tried putting the UserSeedData.json in the wwwroot folder. However, I can't figure out how to traverse the file structure in the deployed app or tell it how to navigate to the file.

Any help or suggestions would be appreciated. Thank you!

How to traverse file structure in deployed Azure app? Click here
  • Blogger Comment
  • Facebook Comment

0 comments:

Post a Comment

The webdev Team