none
"CreateInstanceFromAndUnwrap" exception "access denied" RRS feed

  • Question

  • Hi,

    I am using for 6 years function CreateInstanceFromAndUnwrap to upload dlls at runtime. 
    Now, without reason, I got exception "Access Denied".
    Why? Any solutions please....

    Thank's
    Alexei 


    The .NET programmer
    Thursday, May 19, 2011 11:21 AM

Answers

  • Hi all,

    A dll file was owned by some in exclusive mode. So other users can't access to it.
    When we detected a problem, we solve it by giving free access permision to other users.

    Thank's
    Alexei 


    The .NET programmer
    • Marked as answer by Alexei_shk Tuesday, May 24, 2011 5:27 AM
    Tuesday, May 24, 2011 5:27 AM

All replies

  • Alexei,

    Please post the detailed exception information, include stacktrace, exception message or even inner exception if it exists in this situation.

     

    Riquel


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Friday, May 20, 2011 2:38 AM
  •  

    Hi Alexei,

     

    It seems that you don’t have permission to access the assembly which you want to load and instance. I think you need to login and run the application as Administrator. Otherwise, if you are running the application on Windows Vista or Windows 7, you may need to disable UAC to access the assembly in special folder.

     

    Sincerely,


    Paul Zhou [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Proposed as answer by Paul Zhou Sunday, May 22, 2011 4:51 AM
    Saturday, May 21, 2011 4:11 AM
  • Hi Paul,

    Thank's for suggestion. I will try it.
    By the way, assembly exists in same folder as other assemblies and not in special folder.

    Thank's
    Alexei 


    The .NET programmer
    Sunday, May 22, 2011 4:56 AM
  • Hi Riquel,

    Stacktrace is:

    Access is denied: '*****.dll'.

       at System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, Boolean isStringized, Evidence assemblySecurity, Boolean throwOnFileNotFound, Assembly locationHint, StackCrawlMark& stackMark)

       at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Boolean stringized, Evidence assemblySecurity, StackCrawlMark& stackMark)

       at System.Reflection.Assembly.LoadFrom(String assemblyFile, Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm)

       at System.Activator.CreateInstanceFrom(String assemblyFile, String typeName, Boolean ignoreCase, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, Evidence securityInfo)

       at System.AppDomain.CreateInstanceFrom(String assemblyFile, String typeName)

       at System.AppDomain.CreateInstanceFromAndUnwrap(String assemblyName, String typeName)

       at ******.Read(String catNo)

     

    Thank's
    Alexei 


    The .NET programmer
    Sunday, May 22, 2011 5:26 AM
  • Hi all,

    A dll file was owned by some in exclusive mode. So other users can't access to it.
    When we detected a problem, we solve it by giving free access permision to other users.

    Thank's
    Alexei 


    The .NET programmer
    • Marked as answer by Alexei_shk Tuesday, May 24, 2011 5:27 AM
    Tuesday, May 24, 2011 5:27 AM