这次在项目中使用DllImport引用了一个DLL,这个DLL依赖的其他DLL在环境变量的Path中设置相应路径,一开始本地调试什么的都没有,但是以发布到IIS中,就提示DllNotFound的异常,起初以为是路径没有找到,但是换了绝对路径后还是这样的错误,找了好久终于发现是Path的原因,在程序中把Path路径打印出来的确少了新加的几个依赖路径,然后接下去:
1. 重启应用程序池 --------- 不行
2. 重启 World Wide Web服务------------不行
3. 重启电脑 ----------- 不行
最终查了下,发现要执行如下命令才可以:
iisreset
至此问题解决!