Windows 10 Application startup exception: System.IO.FileLoadException: Could not load file or assembly NUglify

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
6 years ago
Hello & HELP PLEASE,
Trying to install version 4.0 no source on IIS10.
Installed the Windows hosting as instructed in other posts.

Error in Browser:
An error occurred while starting the application.

.NET Framework 4.7.2115.0 X86 v4.0.0.0    |   Microsoft.AspNetCore.Hosting version 2.0.0-rtm-26452    |    Microsoft Windows 10.0.15063    |   Need help?

Error in log file:

Application startup exception: System.IO.FileLoadException: Could not load file or assembly 'NUglify, Version=1.5.5.0, Culture=neutral, PublicKeyToken=15bc7810aec21b5e' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)
File name: 'NUglify, Version=1.5.5.0, Culture=neutral, PublicKeyToken=15bc7810aec21b5e' ---> 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.
   at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
   at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
   at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
   at System.AppDomain.Load(AssemblyName assemblyRef)
   at Nop.Core.Infrastructure.AppDomainTypeFinder.LoadMatchingAssemblies(String directoryPath)
   at Nop.Core.Infrastructure.WebAppTypeFinder.GetAssemblies()
   at Nop.Core.Infrastructure.NopEngine.ConfigureServices(IServiceCollection services, IConfigurationRoot configuration)
   at Nop.Web.Framework.Infrastructure.Extensions.ServiceCollectionExtensions.ConfigureApplicationServices(IServiceCollection services, IConfigurationRoot configuration)
   at Nop.Web.Startup.ConfigureServices(IServiceCollection services)
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Microsoft.AspNetCore.Hosting.ConventionBasedStartup.ConfigureServices(IServiceCollection services)
   at Microsoft.AspNetCore.Hosting.Internal.WebHost.EnsureApplicationServices()
   at Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication()
6 years ago
Also see thread/topic:
https://www.nopcommerce.com/boards/t/49691/cannot-get-to-the-installer-for-400.aspx


I found my resolution to this situation after following all the prior workarounds in this thread and still getting this error in a windows 10 IIS10 without source install:
Application startup exception: System.IO.FileLoadException: Could not load file or assembly 'NUglify

It seems Windows puts a block on the dll files copied in to the local folders from the download of version 4.0 in the Windows 10 files system.
If you right click view properties on any of the dll files in the root folder of v4.0 you will see they have been blocked. You can click each dll and click the unblock property box on each of them which is a monotonous process. I found a workaround that will accomplish the task using Power Shell 5.2 in my version of Win10.
Open a new instance of Power Shell and run the following command.

gci PASTE_FOLDER_PATH_HERE\*.dll -Recurse | Unblock-File

If folder structure contains folder names with spaces you will have to wrap with quotes as follows

gci "PASTE_FOLDER_PATH_HERE\*.dll" -Recurse | Unblock-File

I hope this helps someone else having the issue I was having, I spent all day yesterday searching and trying to resolve this issue.

My best to all.
6 years ago
If you don't want to mess around with powershell, just zip all the files and then extract them again.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.