简体   繁体   中英

Can't reach file in 'wwwroot' when project is deployed

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

Most likely the file is not being deployed. Assuming you're using Visual Studio, try this:

  1. In Solution Explorer, right click your .xlsx file and choose Properties.
  2. In Build Action , make sure Content is selected.
  3. 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM