Deploying .NET COM dll, getting error (0x80070002)

旧城冷巷雨未停 提交于 2019-12-08 05:25:29

If is File Not Found, not a permission problem. The 7 indicates a Windows error, 2 is ERROR_FILE_NOT_FOUND. The usual trouble with COM visible components is either Windows or the CLR not being able to find dependent DLLs. But that should generate a different error code. Look for trouble in your source code, trying to open files without using the full path name of the file. The working directory will be different on your server. Best way to solve this is to use a debugger.

Found the problem with this. Not completely sure I understand it, but I do have it working. Special Thanks to nobugz for getting me to focus on the path.

Filemon was showing a dependent (managed .NET) .dll being found in our test environment but not production.

The key was that in production our network team chose to deploy to a different folder then test, so we had:

PROD
D:_Websites\DocWebV2\LTMRender
TEST
D:_Websites\LTMRender

When I changed TEST to use the same folder structure as PROD, the problem was reproducible.

My assembly, being a COM .dll was found because it was registered. The dependent .dll was not registered, so windows was doing the whole check GAC, then the PATH folders, then the executing process folder and not finding it.

I always assumed that the “executing process folder” would be the .dll folder (as it calls the dependent .dll), but it looks like the web page is the executing process.

Now what I don’t understand is why D:_Websites\LTMRender gets checked. It’s not in our PATH. I am assuming IIS is doing something with this, as d:_WebSites is the root folder for all the web settings in there. I’m no expert on IIS, so I’ll just assume it’s controlling this somehow.

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