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

[亡魂溺海] 提交于 2021-02-10 06:31:06

问题


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:

  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.



来源:https://stackoverflow.com/questions/64593227/cant-reach-file-in-wwwroot-when-project-is-deployed

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!