locked
System.Private.CoreLib.dll' could not be opened -- Access to the path is denied error in ASP.NET Core Web API running on Free-Tier App Service RRS feed

  • Question

  • Framework: ASP.NET Core 2.1

    What happened: I have an ASP.NET Core 2.1 Web API project. This project is performing c# code script evaluations using the Roslyn scripting APIs. This project is running on a free-tier Azure App Service. I decided to stress test my APIs. After sending 20 requests to my API in quick succession, I started getting this access denied error when running the "CreateDelagate()" method from the Roslyn scripting APIs.

    Repro steps: create asp.net core 2.1 web api project > install Microsoft.CodeAnalysis.CSharp.Scripting nuget package > inside controllers class, perform some c# script evaluation > publish to free-tier azure app service > use Nightingale REST API client or Postman to send a request to trigger that c# script evaluation > repeatedly send a request in quick succession (20 or so) > access denied error eventually occurs. Coincidentally, the memory usage when the failure occurs is at around 400MB+. 

    Note: I have attempted to run this asp.net core project on my machine's localhost and stress test it. I sent 100 requests in quick succession. The memory usage spiked up to 900MB, but I never encountered any exceptions whatsoever while running on my local machine. 

    Error message: error CS0009: Metadata file 'D:\Program Files (x86)\dotnet\shared\Microsoft.NETCore.App\2.1.10\System.Private.CoreLib.dll' could not be opened -- Access to the path is denied.

    Stack Trace:

    at Microsoft.CodeAnalysis.Scripting.ScriptBuilder.ThrowIfAnyCompilationErrors(DiagnosticBag diagnostics, DiagnosticFormatter formatter)
       at Microsoft.CodeAnalysis.Scripting.ScriptBuilder.CreateExecutor[T](ScriptCompiler compiler, Compilation compilation, Boolean emitDebugInformation, CancellationToken cancellationToken)
       at Microsoft.CodeAnalysis.Scripting.Script`1.GetExecutor(CancellationToken cancellationToken)
       at Microsoft.CodeAnalysis.Scripting.Script`1.CommonGetExecutor(CancellationToken cancellationToken)
       at Microsoft.CodeAnalysis.Scripting.Script`1.TryGetPrecedingExecutors(Script lastExecutedScriptInChainOpt, CancellationToken cancellationToken)
       at Microsoft.CodeAnalysis.Scripting.Script`1.GetPrecedingExecutors(CancellationToken cancellationToken)
       at Microsoft.CodeAnalysis.Scripting.Script`1.CreateDelegate(CancellationToken cancellationToken)
       at Nightingale.CsharpApiTestEngine.RoslynEngine.Execute()
       at Nightingale.CsharpApiTestEngine.Evaluator.Evaluate(ApiTestModel apitTestModel)
       at Nightingale.Cloud.ApiTestEvaluator.Controllers.ApiTestController.Post(ApiTestModel value)


    • Edited by jeniusapps Friday, May 24, 2019 6:48 AM
    Friday, May 24, 2019 6:38 AM

Answers

  • Hi,

    Since the app is running on Free tier the resources are shared by multiple applications. There could be multiple reasons for this issue. 

    Please try upgrading to at least Basic tier and then test.

    Please let me know if this helps.

    Friday, May 24, 2019 8:57 AM

All replies

  • Hi,

    Since the app is running on Free tier the resources are shared by multiple applications. There could be multiple reasons for this issue. 

    Please try upgrading to at least Basic tier and then test.

    Please let me know if this helps.

    Friday, May 24, 2019 8:57 AM
  • I have upgraded my app service to B1 and I no longer see the error occurring. I wonder if I was encountering a resource limitation while stress testing my application while using the free-tier. Thank you for your suggestion to upgrading to a higher tier; it didn't occur to me that the app service's performance is greatly limited while using the free-tier. 
    Saturday, May 25, 2019 10:49 PM