none
winform application - prompted - An attempt was made to load an assembly from a network location RRS feed

  • Question

  • Hi, I have a winform application, it runs well in my PC and other PC, but in some PC it prompted 

    System.NotSupportedException: An attempt was made to load an assembly from a network location which would have caused the assembly to be sandboxed in previous versions of the .NET Framework. This release of the .NET Framework does not enable CAS policy by default, so this load may be dangerous.   

    My application does not load referenced DLL or assembly from network / remote location. 

    But how do I know which referenced is trying to access remote location?

    Thursday, March 26, 2020 2:50 AM

All replies

  • i managed to workaround by adding following to the configuration file

    <loadFromRemoteSources enabled="true"/> 

    however, I wish to solve it permanently, make sure i have all the referenced in place without access remotely.

    please advise. thank you


    Thursday, March 26, 2020 3:04 AM
  • Hi anonyHeng,

    Thank you for posting here.

    If an application has been copied from the web, it is flagged by Windows as being a web application, even if it resides on the local computer.

    So sometimes this problem will occur. There are generally three ways to deal with this problem.

    1. Enable the loadFromRemoteSources switch. Like you did before.

    2. Manually unblock the file. Right-click the appropriate assembly and click unlock.

    The Unblock button will not appear if the assembly is already unblocked and available.

    If the obtained file is a zip file, you can do this on the zip file before decompression the file.

    3. Use Assembly.UnsafeLoadFrom () method instead of Assembly.LoadFrom () to load local assemblies that the operating system has marked as loaded from the web.

    Please note that I did not actually encounter this problem. The above information was found on the Internet. 

    I am not sure if these can solve the problem. You can try it.

    Best Regards,

    Timon


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


    Thursday, March 26, 2020 8:01 AM
  • Hi,

    Has your issue been resolved?

    If so, please click "Mark as answer" to the appropriate answer, so that it will help other members to find the solution quickly if they face a similar issue.

    Best Regards,

    Timon


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, April 9, 2020 8:32 AM