"FileLoadException: Assembly is still being loaded." when running ASP.NET Core in script
I have a script for running a minimal ASP.NET Core site in LINQPad, which used to work perfectly a few months ago (on a different machine, and probably an older version of LINQPad).
I now get:
It happens in the line: `void Main() => WebHost.CreateDefaultBuilder().UseStartup().Build().Run();`. Any ideas? Thanks!
I now get:
Assembly is still being loaded. (Exception from HRESULT: 0x80131016) at Microsoft.AspNetCore.Hosting.WebHostBuilderIISExtensions.UseIIS(IWebHostBuilder hostBuilder) at Microsoft.AspNetCore.WebHost.CreateDefaultBuilder(String[] args) at Microsoft.AspNetCore.WebHost.CreateDefaultBuilder() at UserQuery.Main() at System.Threading.ThreadHelper.ThreadStart_Context(Object state) at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart()The script is here: http://share.linqpad.net/s84g2a.linq
It happens in the line: `void Main() => WebHost.CreateDefaultBuilder().UseStartup().Build().Run();`. Any ideas? Thanks!
Comments
http://share.linqpad.net/ole7mo.linq
I've added a binding redirect in the app.config (press F4 to see it). The binding redirect shouldn't technically be required, but it appears that something weird is going on in the CLR.