Problem registering a dll - Access Denied

别说谁变了你拦得住时间么 提交于 2019-12-22 05:09:36

问题


When trying to run regasm in Win2008 Server:

regasm "C:\Program Files\FooProg\Bar.dll" /tlb:"C:\Program Files\FooProg\Bar.tlb"

I get the following error:

RegAsm : error RA0000 : An error occurred while saving the exported type library: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))

what does this mean


回答1:


The account under which you run regasm doesn't have rights to write to C:\Program Files\FooProg\ and that's why regasm fails to write the .tlb. Run regasm under an account with administrator priviledges.




回答2:


That error mostlikely comes up because you can't delete a corresponding .tlb file. Two other suggestions:

  1. Stop IIS and attempt to register again:
  2. Stop IIS, remove .tlb files from wherever your DLL file is and then attempt to register again.
  3. Close all IE/IIS/DEV tools (they might be keeping some files in read-only state) and then attempt to register your DLL



回答3:


The account you are using needs administrator privileges.




回答4:


That error mostlikely comes up because you can't delete a corresponding .tlb file. Two other suggestions: 1. Stop IIS and attempt to register again: 2. Stop IIS, remove .tlb files from wherever your DLL file is and then attempt to register again.




回答5:


In my case both the .dll and .tlb file were ReadOnly removing the ReadOnly check worked for me, also i have closed the process that was using it like(Visual Studio IDE).




回答6:


You can also get this problem if you don't specify a full path in the /tlb argument.

It'll attempt to write to C:\windows\system32. Even if you run as Administrator, by default you don't have rights to write to that directory.

The solution is simply to provide a full path (to a directory you have rights to) in the /tlb argument.




回答7:


More than likely you are getting the error due to a process having hooks into the .dll or .tlb file that you are trying to register or copy. Restart your machine and try again or delete the .tlb file and rebuild it to be sure you can access it.




回答8:


I had a stray dllhost.exe process. Killing it allowed me to delete the .tlb file and re-register. Other approaches (Stopping IIS, stopping application pools, closing all IDE's) had no effect.




回答9:


First I had to remove all spaces in the path to my dll before regasm found the dll file.

But when I tried with quotation marks around the targets it worked anyway.




回答10:


Win 7 (if are already administrator) - You can enable permissions for the file by right clicking and accessing properties, security tab, click edit, check on the allow for the permissions, e.g. Full control.




回答11:


For me, file was being used by other application



来源:https://stackoverflow.com/questions/1847763/problem-registering-a-dll-access-denied

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