问题
when I work in debug with IIS Express in visual studio and try to reach a file in /wwwroot, I don't have any problem with the path = 'wwwroot/fileName'.
But when I deploy my website into IIS Express server, I can't reach the file anymore and I get error because the file doesn't exist.
Did I make something wrong ? Did the path is not the same when WebSite is deploy ?
PS : The file is '.xlsx' extension
回答1:
Most likely the file is not being deployed. Assuming you're using Visual Studio, try this:
- In Solution Explorer, right click your .xlsx file and choose Properties.
- In Build Action, make sure Content is selected.
- In Copy to Output Directory, make sure you have either Copy Always or Copy if Newer. Just make sure Do Not Copy is not selected.
My guess is you will find something wrong with that Content field. Deploy again and you should be good to go.
来源:https://stackoverflow.com/questions/64593227/cant-reach-file-in-wwwroot-when-project-is-deployed