Home

Apr 16, 2012

Could not load file or assembly - Operation is not supported. (Exception from HRESULT: 0x80131515)

 

I was getting below error while deploying assembly from DEV to QA. It was because assembly was blocked on Windows 2008 R2. In order to fix this, right click on assembly dll and then click unblock button(see below img).


Unhandled Exception: System.IO.FileLoadException: Could not load file or assembly 'file:///C:\Program Files\Microsoft Dynamics CRM\Server\bin\assembly\Plugin.dll' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)
   at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
   at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
   at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection, Boolean suppressSecurityChecks)
   at System.Reflection.RuntimeAssembly.InternalLoadFrom(String assemblyFile, Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm, Boolean forIntrospection, Boolean suppressSecurityChecks, StackCrawlMark& stackMark)
   at System.Reflection.Assembly.LoadFrom(String assemblyFile)
   at PluginRegistrationTool.AssemblyReader.LoadAssembly(String path) in C:\Amol\CRM 2011 Material\Sdk\sdk\tools\pluginregistration\AssemblyReader.cs:line 236
   at PluginRegistrationTool.AssemblyReader.RetrievePluginsFromAssembly(String path) in C:\Amol\CRM 2011 Material\Sdk\sdk\tools\pluginregistration\AssemblyReader.cs:line 115
   at PluginRegistrationTool.AssemblyReader.RetrievePluginsFromAssembly(String path)
   at PluginRegistrationTool.RegistrationHelper.RetrievePluginsFromAssembly(String pathToAssembly) in C:\Amol\CRM 2011 Material\Sdk\sdk\tools\pluginregistration\RegistrationHelper.cs:line 42
   at PluginRegistrationTool.PluginRegistrationForm.btnLoadAssembly_Click(Object sender, EventArgs e) in C:\Amol\CRM 2011 Material\Sdk\sdk\tools\pluginregistration\PluginRegistrationForm.cs:line 167
Inner Exception: 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. If this load is not intended to sandbox the assembly, please enable the loadFromRemoteSources switch. See http://go.microsoft.com/fwlink/?LinkId=155569 for more information.

image

Thanks,

Amol

7 comments:

ibm said...

in my machine(Windows server 2008 standerd r2) when i take the dll property window the Security Unlock portion is missing ,Now How can i fix the issue

lakshmi narayana vejendla said...

"Unlock" option works for me

lakshmi narayana vejendla said...

"Unlock" button works for me. Thanks much

John Doe said...

Thanks it works on me

mahesh sharma said...

Thanks its working

Zeev Cohen said...

under C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow

Add to vstest.exe.config the next lines



Julio Pérez said...

Worked for me too.

Thanks!