iisnode not able to access file present in network file path

夙愿已清 提交于 2020-05-17 08:10:41

问题


I am node app through iisnode. I can access file present in network path but when the application tries to access the file, it complains ' File doesn't exist'.

I tried adding IIS_IUSRS user group to have access to iisnode www directory in my local machine. I changed the username(from application pool) of the application to which I have permission(R/W) on the network path. Restarted my machine. But still problem persist.

Can someone help me if there is issue between iisnode and network file path.

const csv=require('csvtojson');  
function fetchFile(){
sUsagefile ="\\\\abc\\xyz\\com.csv" .
 csv().fromFile(sUsagefile));  
 console.log(sUsagefile);
}

Error: File does not exist. Check to make sure the file path to your csv is correct.
    at C:\iisnode\www\node_modules\csvtojson\v2\Converter.js:81:37
    at FSReqWrap.cb [as oncomplete] (fs.js:312:19)

回答1:


I tried to access UNC path with iisnode and it was working perfectly. Have you tried to grant IUSR and IIS Apppool\ read/writepermission for network path \abc\xyz\com.csv directly?

Besides, have you checked whether \abc\xyz\com.csv can be accessed from file explorer when IIS stop working.

It is suggested to use process monitor tool to monitor what path is read by node.exe. Please download process monitor from here:https://docs.microsoft.com/zh-cn/sysinternals/downloads/procmon then add a filter like “Path contains com.csv". Finally we would know what path the application is trying to read.



来源:https://stackoverflow.com/questions/57807014/iisnode-not-able-to-access-file-present-in-network-file-path

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