Unhandled TypeLoadException: Unable to Load Microsoft.Extensions.Diagnostics.Metrics.MetricsServiceExtensions in .NET 8 Web API on Railway.app Deployment
chihkang
HOBBYOP

2 years ago

Environment

Platform: Railway.app

Framework: .NET 8.0

Project Type: ASP.NET Core Web API

Unhandled exception. System.TypeLoadException: Could not load type 'Microsoft.Extensions.Diagnostics.Metrics.MetricsServiceExtensions' from assembly 'Microsoft.Extensions.Diagnostics, Version=8.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.

at Microsoft.AspNetCore.Hosting.GenericWebHostBuilder.<.ctor>b__4_2(HostBuilderContext context, IServiceCollection services)

at Microsoft.AspNetCore.Hosting.BootstrapHostBuilder.RunDefaultCallbacks()

at Microsoft.AspNetCore.Builder.WebApplicationBuilder..ctor(WebApplicationOptions options, Action`1 configureDefaults)

at Microsoft.AspNetCore.Builder.WebApplication.CreateBuilder(String[] args)

at Program.$(String[] args) in /app/Program.cs:line 7

Additional Context

The application runs successfully in local development environment

The error occurs specifically during Railway.app deployment

No explicit usage of Metrics services in the application code

Using Quartz.NET for background job scheduling

View Deploy details

> ⓘ Deployment information is only viewable by project members and Railway employees.

0 Replies

Welcome!

Sign in to your Railway account to join the conversation.

Loading...