Open Closed

App service is failing to start #1924


0
dannyb created

I am attempting to publish the application onto Azure. But sadly the services are not starting. Attached is the stdout.

If you're creating a bug/problem report, please include followings:

  • ABP Framework version: v4.4.2
  • UI type: Angular / MVC / ~~Blazor~~
  • DB provider: ~~EF Core~~ / MongoDB
  • Tiered (MVC) or Identity Server Separated (Angular): ~~yes~~ / no
  • Exception message and stack trace:
[14:13:39 INF] Starting Togarrach.Core.IdentityServer.
[14:13:47 INF] Azure Web Sites environment detected. Using 'C:\home\ASP.NET\DataProtection-Keys' as key repository; keys will not be encrypted at rest.
[14:13:48 INF] Loaded ABP modules:

{{ OMMITED AS STRING LIMIT REACHED }}

[14:13:48 FTL] Application startup exception
Volo.Abp.AbpInitializationException: An error occurred during the initialize Volo.Abp.Modularity.OnApplicationInitializationModuleLifecycleContributor phase of the module Volo.Abp.AspNetCore.AbpAspNetCoreModule, Volo.Abp.AspNetCore, Version=4.4.2.0, Culture=neutral, PublicKeyToken=null: An exception was thrown while activating ?:Volo.Abp.AspNetCore.VirtualFileSystem.IWebContentFileProvider -> Volo.Abp.AspNetCore.VirtualFileSystem.WebContentFileProvider -> ?:Volo.Abp.VirtualFileSystem.IVirtualFileProvider -> Volo.Abp.VirtualFileSystem.VirtualFileProvider.. See the inner exception for details.
 ---> Autofac.Core.DependencyResolutionException: An exception was thrown while activating ?:Volo.Abp.AspNetCore.VirtualFileSystem.IWebContentFileProvider -> Volo.Abp.AspNetCore.VirtualFileSystem.WebContentFileProvider -> ?:Volo.Abp.VirtualFileSystem.IVirtualFileProvider -> Volo.Abp.VirtualFileSystem.VirtualFileProvider.
 ---> Autofac.Core.DependencyResolutionException: An exception was thrown while invoking the constructor 'Void .ctor(Microsoft.Extensions.Options.IOptions`1[Volo.Abp.VirtualFileSystem.AbpVirtualFileSystemOptions], Volo.Abp.VirtualFileSystem.IDynamicFileProvider)' on type 'VirtualFileProvider'.
 ---> System.IO.DirectoryNotFoundException: C:\home\site\Togarrach.Core.Domain.Shared\
   at Microsoft.Extensions.FileProviders.PhysicalFileProvider..ctor(String root, ExclusionFilters filters)
   at Volo.Abp.VirtualFileSystem.VirtualFileSetListExtensions.ReplaceEmbeddedByPhysical[T](VirtualFileSetList fileSets, String physicalPath)
   at Togarrach.Core.CoreIdentityServerModule.<>c__DisplayClass0_0.<ConfigureServices>b__3(AbpVirtualFileSystemOptions options) in C:\SourceControl\TogarrachCore\src\Togarrach.Core.IdentityServer\CoreIdentityServerModule.cs:line 88
   at Microsoft.Extensions.Options.ConfigureNamedOptions`1.Configure(String name, TOptions options)
   at Microsoft.Extensions.Options.OptionsFactory`1.Create(String name)
   at Microsoft.Extensions.Options.OptionsManager`1.<>c__DisplayClass5_0.<Get>b__0()
   at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
   at System.Lazy`1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)
   at System.Lazy`1.CreateValue()
   at System.Lazy`1.get_Value()
   at Microsoft.Extensions.Options.OptionsCache`1.GetOrAdd(String name, Func`1 createOptions)
   at Microsoft.Extensions.Options.OptionsManager`1.Get(String name)
   at Microsoft.Extensions.Options.OptionsManager`1.get_Value()
   at Volo.Abp.VirtualFileSystem.VirtualFileProvider..ctor(IOptions`1 options, IDynamicFileProvider dynamicFileProvider)
   at lambda_method1049(Closure , Object[] )
   at Autofac.Core.Activators.Reflection.BoundConstructor.Instantiate()
   --- End of inner exception stack trace ---
   at Autofac.Core.Activators.Reflection.BoundConstructor.Instantiate()
   at Autofac.Core.Activators.Reflection.ReflectionActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters)
   at Autofac.Core.Activators.Reflection.ReflectionActivator.<ConfigurePipeline>b__11_0(ResolveRequestContext ctxt, Action`1 next)
   at Autofac.Core.Resolving.Middleware.DelegateMiddleware.Execute(ResolveRequestContext context, Action`1 next)
   at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext ctxt)
   at Autofac.Core.Resolving.Middleware.DisposalTrackingMiddleware.Execute(ResolveRequestContext context, Action`1 next)
   at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.&lt;&gt;c__DisplayClass14_0.&lt;BuildPipeline&gt;b__1(ResolveRequestContext ctxt)
   at Autofac.Builder.RegistrationBuilder`3.<>c__DisplayClass41_0.<PropertiesAutowired>b__0(ResolveRequestContext ctxt, Action`1 next)
   at Autofac.Core.Resolving.Middleware.DelegateMiddleware.Execute(ResolveRequestContext context, Action`1 next)
   at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext ctxt)
   at Autofac.Core.Resolving.Middleware.ActivatorErrorHandlingMiddleware.Execute(ResolveRequestContext context, Action`1 next)
   --- End of inner exception stack trace ---
   at Autofac.Core.Resolving.Middleware.ActivatorErrorHandlingMiddleware.Execute(ResolveRequestContext context, Action`1 next)
   at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext ctxt)
   at Autofac.Core.Pipeline.ResolvePipeline.Invoke(ResolveRequestContext ctxt)
   at Autofac.Core.Resolving.Middleware.RegistrationPipelineInvokeMiddleware.Execute(ResolveRequestContext context, Action`1 next)
   at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.&lt;&gt;c__DisplayClass14_0.&lt;BuildPipeline&gt;b__1(ResolveRequestContext ctxt)
   at Autofac.Core.Resolving.Middleware.SharingMiddleware.&lt;&gt;c__DisplayClass5_0.&lt;Execute&gt;b__0()
   at Autofac.Core.Lifetime.LifetimeScope.CreateSharedInstance(Guid id, Func`1 creator)
   at Autofac.Core.Lifetime.LifetimeScope.CreateSharedInstance(Guid primaryId, Nullable`1 qualifyingId, Func`1 creator)
   at Autofac.Core.Resolving.Middleware.SharingMiddleware.Execute(ResolveRequestContext context, Action`1 next)
   at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.&lt;&gt;c__DisplayClass14_0.&lt;BuildPipeline&gt;b__1(ResolveRequestContext ctxt)
   at Autofac.Core.Resolving.Middleware.ScopeSelectionMiddleware.Execute(ResolveRequestContext context, Action`1 next)
   at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext ctxt)
   at Autofac.Core.Resolving.Middleware.CircularDependencyDetectorMiddleware.Execute(ResolveRequestContext context, Action`1 next)
   at Autofac.Core.Resolving.Pipeline.ResolvePipelineBuilder.&lt;&gt;c__DisplayClass14_0.&lt;BuildPipeline&gt;b__1(ResolveRequestContext ctxt)
   at Autofac.Core.Pipeline.ResolvePipeline.Invoke(ResolveRequestContext ctxt)
   at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, ResolveRequest request)
   at Autofac.Core.Resolving.ResolveOperation.ExecuteOperation(ResolveRequest request)
   at Autofac.Core.Resolving.ResolveOperation.Execute(ResolveRequest request)
   at Autofac.Core.Lifetime.LifetimeScope.ResolveComponent(ResolveRequest request)
   at Autofac.ResolutionExtensions.TryResolveService(IComponentContext context, Service service, IEnumerable`1 parameters, Object& instance)
   at Autofac.ResolutionExtensions.ResolveService(IComponentContext context, Service service, IEnumerable`1 parameters)
   at Autofac.ResolutionExtensions.Resolve(IComponentContext context, Type serviceType, IEnumerable`1 parameters)
   at Autofac.ResolutionExtensions.Resolve(IComponentContext context, Type serviceType)
   at Autofac.Extensions.DependencyInjection.AutofacServiceProvider.GetRequiredService(Type serviceType)
   at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType)
   at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[T](IServiceProvider provider)
   at Volo.Abp.AspNetCore.AbpAspNetCoreModule.OnApplicationInitialization(ApplicationInitializationContext context)
   at Volo.Abp.Modularity.OnApplicationInitializationModuleLifecycleContributor.Initialize(ApplicationInitializationContext context, IAbpModule module)
   at Volo.Abp.Modularity.ModuleManager.InitializeModules(ApplicationInitializationContext context)
   --- End of inner exception stack trace ---
   at Volo.Abp.Modularity.ModuleManager.InitializeModules(ApplicationInitializationContext context)
   at Volo.Abp.AbpApplicationBase.InitializeModules()
   at Volo.Abp.AbpApplicationWithExternalServiceProvider.Initialize(IServiceProvider serviceProvider)
   at Microsoft.AspNetCore.Builder.AbpApplicationBuilderExtensions.InitializeApplication(IApplicationBuilder app)
   at Togarrach.Core.Startup.Configure(IApplicationBuilder app) in C:\Togarrach.Core.IdentityServer\Startup.cs:line 22
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at Microsoft.AspNetCore.Hosting.ConfigureBuilder.Invoke(Object instance, IApplicationBuilder builder)
   at Microsoft.AspNetCore.Hosting.ConfigureBuilder.<>c__DisplayClass4_0.<Build>b__0(IApplicationBuilder builder)
   at Microsoft.AspNetCore.Hosting.GenericWebHostBuilder.<>c__DisplayClass15_0.<UseStartup>b__1(IApplicationBuilder app)
   at Microsoft.ApplicationInsights.AspNetCore.ApplicationInsightsStartupFilter.<>c__DisplayClass2_0.<Configure>b__0(IApplicationBuilder app)
   at Microsoft.AspNetCore.Mvc.Filters.MiddlewareFilterBuilderStartupFilter.<>c__DisplayClass0_0.<Configure>g__MiddlewareFilterBuilder|0(IApplicationBuilder builder)
   at Microsoft.AspNetCore.Server.IISIntegration.IISSetupFilter.<>c__DisplayClass4_0.<Configure>b__0(IApplicationBuilder app)
   at Microsoft.AspNetCore.HostFilteringStartupFilter.<>c__DisplayClass0_0.<Configure>b__0(IApplicationBuilder app)
   at Microsoft.AspNetCore.Hosting.GenericWebHostService.StartAsync(CancellationToken cancellationToken)
[14:13:48 INF] Now listening on: http://127.0.0.1:24071
[14:13:48 INF] Application started. Press Ctrl+C to shut down.
[14:13:48 INF] Hosting environment: Development
[14:13:48 INF] Content root path: C:\home\site\wwwroot
[14:13:49 INF] Request starting HTTP/1.1 GET {{Removed}} - -


  • Steps to reproduce the issue:"

10 Answer(s)
  • 0
    berkansasmaz created
    Support Team

    Hi,

    You are probably not running the application in the Production environment.

    Please make sure ASPNETCORE_ENVIRONMENT is Production!

    The offending piece of code is the following code inside MyProjectNameIdentityServerModule under MyProjectName.IdentityServer project. This piece of code is set to run only in Developmentenvironment.

    If you want, you can delete this piece of code and publish it again (on Azure or local machine) to make sure this is the problem. I think you will not get error this time.

    If you don't get an error, you can fix the problem permanently by setting ASPNETCORE_ENVIRONMENT to Production where you run the application.

    For more information you can check here.

  • 0
    dannyb created

    Hi,

    You are probably not running the application in the Production environment.

    Please make sure ASPNETCORE_ENVIRONMENT is Production!

    The offending piece of code is the following code inside MyProjectNameIdentityServerModule under MyProjectName.IdentityServer project. This piece of code is set to run only in Developmentenvironment.

    If you want, you can delete this piece of code and publish it again (on Azure or local machine) to make sure this is the problem. I think you will not get error this time.

    If you don't get an error, you can fix the problem permanently by setting ASPNETCORE_ENVIRONMENT to Production where you run the application.

    For more information you can check here.

    Hey berkansasmaz, thank you for the quick reply! It is a dev build running on Azure - ASPNETCORE_ENVIRONMENT is Development (as intended).

    Will test your solution later this evening and close if resolved.

  • 0
    dannyb created

    Hi,

    You are probably not running the application in the Production environment.

    Please make sure ASPNETCORE_ENVIRONMENT is Production!

    The offending piece of code is the following code inside MyProjectNameIdentityServerModule under MyProjectName.IdentityServer project. This piece of code is set to run only in Developmentenvironment.

    If you want, you can delete this piece of code and publish it again (on Azure or local machine) to make sure this is the problem. I think you will not get error this time.

    If you don't get an error, you can fix the problem permanently by setting ASPNETCORE_ENVIRONMENT to Production where you run the application.

    For more information you can check here.

    Hey berkansasmaz, thank you for the quick reply!
    It is a dev build running on Azure - ASPNETCORE_ENVIRONMENT is Development (as intended).

    Will test your solution later this evening and close if resolved.

    I appear to still be having issues.

    Is it not possible to run a Development build on Azure as an App Service?

  • 0
    berkansasmaz created
    Support Team

    This is possible, if you delete the code in the picture in my previous answer from the MyProjectName.IdentityServer(and other projects) project, you can publish and run it with the Development environment variable.

    But, I cannot recommend publishing the application in the Development environment because; In general,it is desirable that the Development and Production environment be as similar as possible. However, there are a few fundamental differences. For example, while the UseDeveloperExceptionPage middleware is requested to work only with the Development environment variable, the UseErrorPage middleware is requested to run in the Production environment. Considering such situations, even if what you want is not recommended, it does not mean that you cannot do it.

  • 0
    dannyb created

    This is possible, if you delete the code in the picture in my previous answer from the MyProjectName.IdentityServer(and other projects) project, you can publish and run it with the Development environment variable.

    But, I cannot recommend publishing the application in the Development environment because; In general,it is desirable that the Development and Production environment be as similar as possible. However, there are a few fundamental differences. For example, while the UseDeveloperExceptionPage middleware is requested to work only with the Development environment variable, the UseErrorPage middleware is requested to run in the Production environment. Considering such situations, even if what you want is not recommended, it does not mean that you cannot do it.

    Thank you. I have been unable to run a release (Production) build of the application. Even on my local machine I am unable to run the Release build through dotnet Togarrach.Core.IdentityServer.dll

    The stdout on Azure is also blank.

  • 0
    berkansasmaz created
    Support Team

    Is the log of the published application you run locally empty? If it is not empty, could you share the relevant log?

  • 0
    dannyb created

    Is the log of the published application you run locally empty? If it is not empty, could you share the relevant log?

    Aye, it is empty. This is the log stream from Azure when attempting to run the app service.

    Connecting... 2021-10-12T20:54:45 Welcome, you are now connected to log-streaming service. The default timeout is 2 hours. Change the timeout with the App Setting SCM_LOGSTREAM_TIMEOUT (in seconds). 2021-10-12T20:54:51 PID[5372] Information Unpacking resources... 2021-10-12T20:54:51 PID[5372] Information 10-12 20:54:51 Information: Executing Application Insights Profiler agent version 2.6.2010.2703 with arguments: 2021-10-12T20:54:51 PID[5372] Information 10-12 20:54:51 Information: Minimum version enabled on machine: 1.0.0 2021-10-12T20:54:51 PID[5372] Information 10-12 20:54:51 Information: Applying logging level: Information 2021-10-12T20:54:51 PID[5372] Information 10-12 20:54:51 Information: Instrumentation key: **removed** 2021-10-12T20:54:51 PID[5372] Information 10-12 20:54:51 Information: Application Insights Profiler endpoint: https://agent.azureserviceprofiler.net 2021-10-12T20:54:51 PID[5372] Information 10-12 20:54:51 Information: Application Insights endpoint: https://dc.services.visualstudio.com 2021-10-12T20:54:51 PID[5372] Information 10-12 20:54:51 Information: Runtime Environment: Antares 2021-10-12T20:54:51 PID[5372] Information 10-12 20:54:51 Information: Support files: C:\local\Temp\jobs\continuous\ApplicationInsightsProfiler3\ntngl1ww.tjk\spsupport 2021-10-12T20:54:51 PID[5372] Information 10-12 20:54:51 Information: Providing usage data (to opt out set the AppSettings ApplicationInsightsProvideUsageTelemetryData with the value "false"): True 2021-10-12T20:54:51 PID[5372] Information 10-12 20:54:51 Information: Engine mode: Sampling 2021-10-12T20:54:52 PID[5372] Information 10-12 20:54:52 Information: Application Insights AppId: **removed** 2021-10-12T20:54:52 PID[5372] Information 10-12 20:54:52 Information: Press 'Ctrl+C' to exit Application Insights Profiler. 2021-10-12T20:54:52 PID[5372] Information 10-12 20:54:52 Information: Set up shutdown handler. 2021-10-12T20:54:52 PID[5372] Information 10-12 20:54:52 Information: Shutdown handler set to watch C:\local\Temp\JobsShutdown\continuous\ApplicationInsightsProfiler3\ox0av3hd.jci. 2021-10-12T20:54:52 PID[5372] Information 10-12 20:54:52 Information: Starting main process 2021-10-12T20:54:53 PID[5372] Information 10-12 20:54:53 Critical: Settings have been set from Engine 2021-10-12T20:54:53 PID[5372] Information 10-12 20:54:53 Critical: Settings contract has been updated 2021-10-12T20:54:53 PID[5372] Information 10-12 20:54:53 Critical: Enabled has been set to True 2021-10-12T20:56:45 No new trace in the past 1 min(s). 2021-10-12T20:57:45 No new trace in the past 2 min(s).

  • 0
    berkansasmaz created
    Support Team

    Hi,

    As I understand it, our first problem has been solved. 👇👇

    I am attempting to publish the application onto Azure. But sadly the services are not starting. Attached is the stdout.

    Because the error in the first log record does not appear in the log anymore.

    Coming to our current problem, I don't think it's related to ABP. There is no information about ABP in the last log you sent.

    In this case, unfortunately I can't be of any further help 😔

    Maybe you can consider lowering the log level of the application, then there may be information about ABP.

  • 0
    dannyb created

    Hi,

    As I understand it, our first problem has been solved. 👇👇

    I am attempting to publish the application onto Azure. But sadly the services are not starting. Attached is the stdout.

    Because the error in the first log record does not appear in the log anymore.

    Coming to our current problem, I don't think it's related to ABP. There is no information about ABP in the last log you sent.

    In this case, unfortunately I can't be of any further help 😔

    I would say partially solved

    When publishing to Azure, is there anything specific that needs to happen/be set?

    The first issue was related to the virtual file path and it being a Development build - running it as Release causes the app to not even start.

    I feel something is wrong with the publish settings or app service?

    I appreciate your time and help on this.

  • 0
    berkansasmaz created
    Support Team

    Unfortunately, I would really like to help on this issue, but I have no information. I don't think the problem is related to ABP

    You are trying to view the log records from Azure, but maybe its configuration is missing.

    If you think the problem is really related to ABP, you can send your application or minimal, reproducible example to [email protected]