RESOLVED: PolicyException error after upgrading CU in WebClient

sailorsailor Member Posts: 15
edited 2017-06-15 in NAV Three Tier
I upgraded NAV 2017 CU 12 to CU 20. Couldn't just copy&paste files and folders as I experienced other issues like dev environment crashing when enter Code editor. So had to uninstall and install NAV again.

After that the WebClient doesn't work anymore. Get the following error in the browser:

>>>>
[PolicyException: Required permissions cannot be acquired.]
System.Security.SecurityManager.ResolvePolicy(Evidence evidence, PermissionSet reqdPset, PermissionSet optPset, PermissionSet denyPset, PermissionSet& denied, Boolean checkExecutionPermission) +5280314
System.Security.SecurityManager.ResolveCasPolicy(Evidence evidence, PermissionSet reqdPset, PermissionSet optPset, PermissionSet denyPset, PermissionSet& denied, Int32& securitySpecialFlags, Boolean checkExecutionPermission) +104

[FileLoadException: Could not load file or assembly 'Microsoft.Dynamics.Nav.Types, Version=9.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. Failed to grant minimum permission requests. (Exception from HRESULT: 0x80131417)]
System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +0
System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +234
System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean forIntrospection) +108
System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +25
System.Reflection.Assembly.Load(String assemblyString) +34
System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +49

[ConfigurationErrorsException: Could not load file or assembly 'Microsoft.Dynamics.Nav.Types, Version=9.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. Failed to grant minimum permission requests. (Exception from HRESULT: 0x80131417)]
System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +772
System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() +256
System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai) +58
System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +228
System.Web.Compilation.BuildManager.GetPreStartInitMethodsFromReferencedAssemblies() +77
System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath, Boolean& isRefAssemblyLoaded) +140
System.Web.Compilation.BuildManager.ExecutePreAppStart() +153
System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +880

[HttpException (0x80004005): Could not load file or assembly 'Microsoft.Dynamics.Nav.Types, Version=9.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. Failed to grant minimum permission requests. (Exception from HRESULT: 0x80131417)]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +565
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +118
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +735
<<<<<

All I can find in the web is that the application pool need to be changed to "Load User Profile = True" under advanced settings. Had issues with that before on a different install where we had to set it to False as there is a bug with NAV2017 and Windows 2016 when using a wild card SSL cert. Anyway, changed it but didn't work. Trust Level also set to Full. Running out of ideas now!



Answers

  • sailorsailor Member Posts: 15
    edited 2017-06-15
    Solved it. When copying the files from the CU20 folder, they were all marked as blocked. So right click on the file and there you see now a "Unblock" button. Click it and the that file is done. Now go to all other files and do it, in all folders. Or write a PowerShell script doing it for you.
    4hk80gmkaxov.jpg

    Powershell script:
    GCI c:\temp |unblock-file
    Ls -r c:\temp |Unblock-file

    Run this by folder or make a loop going recursively through the folders from the root.
  • HingentlyHingently Member Posts: 1
    edited 2017-07-07
    Hello mate, and thanks for your tips, i really appreciate it. being on Tirosint (a thyroid drug) it is hard for me to concentrate and learn. thanks for solving it.
  • TomigsTomigs Member Posts: 85
    Hi,
    I'm having a similar issue: when I try to run the webclient for NAV2017. But I haven't been able to resolve yet.

    As sailor was describing, we found out that the files in the folder
    C:\Program Files\Microsoft Dynamics NAV\100\Web Client
    were blocked. So I run the powershell script described by him for these files and they seem to be unblocked now.

    I also confirmed that the parameter Load User Profile is true in the NAV2017 Application Pool.

    But still not working, and I wonder if I have to check other folders to be unblocked. Any advise you can give me?

    I receive the error in Internet Explorer:
    Required permissions cannot be acquired.
    ...
    FileLoadException: Could not load file or assembly 'Microsoft.Dynamics.Nav.Types, Version=10.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. Failed to grant minimum permission
    ...
    wa5u04xn72b0.jpg


    It used to work before. It is a service with certificate, meant to be able externally accesible.

    We have a server with several versions of NAV (2015, 2016, 2017). We upgraded recently the cummulative update on the NAV2017, so I'm guessing it has to do with it.


    Thanks,
    Tomas
  • robintheswederobintheswede Member Posts: 12
    Hi Tomas,
    just delete the cache in Internet Explorer on your computer/server and it should work after unlocking the files. And, also restart the IIS is a good practice. This helped for me at least.
Sign In or Register to comment.