.net local assembly load failed with CAS policy

后端 未结 4 1342
一向
一向 2020-12-01 08:59

We are getting the following assembly load error. The assembly is loaded from the local path \"C:\\Program Files\\ASWorx Products\\ASWorx\\Bin\\\". The problem is not there

相关标签:
4条回答
  • 2020-12-01 09:21

    I had to use the method

    Assembly.UnsafeLoadFrom()
    

    instead of Assembly.LoadFrom, It fixed my issues... Found it at this link:

    https://msdn.microsoft.com/en-us/library/dd409252(VS.100).aspx

    0 讨论(0)
  • 2020-12-01 09:36

    Additionally to the above given answer here my solution for the problem.

    Trying to do the unblocking resulted always that the file still appeared to be blocked.

    So, I made a new folder, copied over the affected files and performed the unblocking file by file. Surprisingly the flag got removed compared to doing the same action in the original file location. So, the final step was copying the now unblocked files back to the original location. Done!

    0 讨论(0)
  • 2020-12-01 09:46

    I am able to resolve this problem using below link and adding the settings to my config.

    https://msdn.microsoft.com/en-us/library/dd409252(VS.100).aspx

    <configuration>
       <runtime>
          <loadFromRemoteSources enabled="true"/>
       </runtime>
    </configuration>
    
    0 讨论(0)
  • 2020-12-01 09:47

    From the link in the error message:

    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. You can change that designation by changing the file properties, or you can use the element to grant the assembly full trust. As an alternative, you can use the UnsafeLoadFrom method to load a local assembly that the operating system has flagged as having been loaded from the web.

    Try opening the file properties and clicking 'Unblock':

    properties window

    0 讨论(0)
提交回复
热议问题