locked
2 DBContext conflict on the Azure server RRS feed

  • Question

  • User-1256377279 posted

    Hi All,

    I have 2 DbContext on startup.cs , one is for Identity and other is other table access. On my local it is fine but when i deploy to Azure following is displayed

    HTTP Error 500.30 - ANCM In-Process Start Failure

    Common solutions to this issue:

    • The application failed to start
    • The application started but then stopped
    • The application started but threw an exception during startup

    Troubleshooting steps:

    • Check the system event log for error messages
    • Enable logging the application process' stdout messages
    • Attach a debugger to the application process and inspect

    My Startup code

      public void ConfigureServices(IServiceCollection services)
            {
                services.AddDbContext<ApplicationDbContext>(options =>
                    options.UseSqlServer(
                        Configuration.GetConnectionString("GlobalometerDBContext")));
                
                services.AddDefaultIdentity<IdentityUser>(options => options.SignIn.RequireConfirmedAccount = true)
                    .AddEntityFrameworkStores<ApplicationDbContext>();
    
    
                services.AddDbContext<GOMLIB.Models.GlobalometerDBContext>(options => options.UseSqlServer(Configuration.GetConnectionString("GlobalometerDBContext")));
    
    
                services.AddMvc();
                //services.AddControllersWithViews();
                services.AddRazorPages();
            }
    

    Thanks for the help

    Thanks,

    Shabbir

    Friday, June 5, 2020 5:16 PM

All replies

  • User-474980206 posted

    Which of the troubleshooting hints have you tried. And what were the results?

    Friday, June 5, 2020 5:25 PM
  • User-1256377279 posted

    Sorry i didn't get you

    Friday, June 5, 2020 6:19 PM
  • User1120430333 posted

    If you have not deployed the Identity database to MS SQL Server and it's still using localdb, then it's not going to work when your solution and the Identity database are deployed to a Web server like IIS.

    Friday, June 5, 2020 6:30 PM
  • User-1256377279 posted

    I have Deployed Identity Migration to the MS SQL Server not using localDB.

    Below is Application server logs

    Application '/LM/W3SVC/2057096125/ROOT' with physical root 'D:\home\site\wwwroot\' failed to load coreclr. Exception message:
    CLR worker thread exited prematurely
    Process Id: 1772.
    File Version: 13.1.20074.3. Description: IIS ASP.NET Core Module V2 Request Handler. Commit: e81033e094d4663ffd227bb4aed30b76b0631e6d
    Application '/LM/W3SVC/2057096125/ROOT' with physical root 'D:\home\site\wwwroot\' hit unexpected managed exception, exception code = '0xe0434352'. First 30KB characters of captured stdout and stderr logs:
    Unhandled exception. System.IO.FileNotFoundException: Could not load file or assembly 'GOMLIB, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.
    File name: 'GOMLIB, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'
       at TACMSWeb.Startup.ConfigureServices(IServiceCollection services)
       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.ConfigureServicesBuilder.InvokeCore(Object instance, IServiceCollection services)
       at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.<>c__DisplayClass9_0.<Invoke>g__Startup|0(IServiceCollection serviceCollection)
       at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.Invoke(Object instance, IServiceCollection services)
       at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.<>c__DisplayClass8_0.<Build>b__0(IServiceCollection services)
       at Microsoft.AspNetCore.Hosting.GenericWebHostBuilder.UseStartup(Type startupType, HostBuilderContext context, IServiceCollection services)
       at Microsoft.AspNetCore.Hosting.GenericWebHostBuilder.<>c__DisplayClass12_0.<UseStartup>b__0(HostBuilderContext context, IServiceCollection services)
       at Microsoft.Extensions.Hosting.HostBuilder.CreateServiceProvider()
       at Microsoft.Extensions.Hosting.HostBuilder.Build()
       at TACMSWeb.Program.Main(String[] args) in F:\Websites\GOM\GOM\TAWeb\Program.cs:line 16
    
    
    
    Process Id: 1772.
    File Version: 13.1.20074.3. Description: IIS ASP.NET Core Module V2 Request Handler. Commit: e81033e094d4663ffd227bb4aed30b76b0631e6d





    Application: w3wp.exe
    CoreCLR Version: 4.700.20.11803
    .NET Core Version: 3.1.3
    Description: The process was terminated due to an unhandled exception.
    Exception Info: System.IO.FileNotFoundException: Could not load file or assembly 'GOMLIB, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.
    File name: 'GOMLIB, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'
       at TACMSWeb.Startup.ConfigureServices(IServiceCollection services)
       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.ConfigureServicesBuilder.InvokeCore(Object instance, IServiceCollection services)
       at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.<>c__DisplayClass9_0.<Invoke>g__Startup|0(IServiceCollection serviceCollection)
       at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.Invoke(Object instance, IServiceCollection services)
       at Microsoft.AspNetCore.Hosting.ConfigureServicesBuilder.<>c__DisplayClass8_0.<Build>b__0(IServiceCollection services)
       at Microsoft.AspNetCore.Hosting.GenericWebHostBuilder.UseStartup(Type startupType, HostBuilderContext context, IServiceCollection services)
       at Microsoft.AspNetCore.Hosting.GenericWebHostBuilder.<>c__DisplayClass12_0.<UseStartup>b__0(HostBuilderContext context, IServiceCollection services)
       at Microsoft.Extensions.Hosting.HostBuilder.CreateServiceProvider()
       at Microsoft.Extensions.Hosting.HostBuilder.Build()
       at TACMSWeb.Program.Main(String[] args) in F:\Websites\GOM\GOM\TAWeb\Program.cs:line 16
    Friday, June 5, 2020 7:07 PM
  • User1120430333 posted

    Unhandled exception. System.IO.FileNotFoundException: Could not load file or assembly 'GOMLIB, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.

    The error has nothing to do with DBcontexts.  Where is the DLL it's talking about? Why is the DLL not in the Bin folder when the solution is deployed?

    Friday, June 5, 2020 7:43 PM
  • User-1256377279 posted

    DLL is already referenced to the project

    Friday, June 5, 2020 8:34 PM
  • User1120430333 posted

    shabbir_215

    DLL is already referenced to the project

    Yeah, it is referenced in the project and the DLL may be sitting on your develop machine in the project's Bin folder. But when the executables for the Web program were deployed to the Azure platform to the Web solution's Bin folder, the Web program is hollering about the missing DLL,  an exception was thrown about it that is an unhandled exception, becuase the DLL is not there for some reason a bad deployment.  

    Where is the DLL that is suppose to be in the Bin folder for that solution that was deployed to the Azure platform. Where is the DLL? Did you go look in the Bin folder of the solution for the DLL after solution  was deployed to Azure? 

    Friday, June 5, 2020 9:13 PM
  • User-474980206 posted

    You will also need any dll’s GOMLIB needs.

    Saturday, June 6, 2020 1:33 AM
  • User-1256377279 posted

    It worked when i manually deploy via FTP to Azure, somehow when i do WebDeploy it doesn't transfer GOMLIB.dll very strange

    Saturday, June 6, 2020 9:17 AM