Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

5.4K
Vistas
ASP .NET Core IIS Deploy IIS AspNetCore Module Error: CLR worker thread exited prematurely

I give IIS every feature in windows, but if your have advice please share me. Anyway I want deploy on IIS Lan server. But i cant. I working on two days this problems. I dont know how can fix this.I use ".net.5.0". My application codes like that

Program.cs

public class Program
{
    public static void Main(string[] args)
    {
        var host = new WebHostBuilder()
            .UseKestrel()
            .UseContentRoot(Directory.GetCurrentDirectory())
            .UseIISIntegration().UseUrls("http://localhost:8080/")
            .UseStartup<Startup>()
            .Build();
    }  
}

Startup

namespace EcommerceGastro.API
{
    public class Startup
    {
        public Startup(IConfiguration configuration)
        {
            Configuration = configuration;
        }

        public IConfiguration Configuration { get; }

        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {

            services.AddDbContext<GastroDB>();
            services.AddScoped<IMainCategoryService, MainCategoryService>();
            services.AddScoped<IProductService, ProductService>();
            services.AddScoped<ICategoryService, CategoryService>();
            services.AddScoped<IUploadImageService, UploadImageService>();
            services.AddAutoMapper(typeof(AutoMapperProfile));
            services.AddControllers();
            services.AddControllers().AddNewtonsoftJson(opt =>
            {
                opt.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore;
            });
        }

        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            app.UseRouting();
            app.UseStaticFiles();
            //Initiliazer.HomePageControl().Wait();
            app.UseAuthorization();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllers();
            });
        }
    }
}

appsettings.json

{
  "Logging": {
    "LogLevel": {
      "Default": "Information",
      "Microsoft": "Warning",
      "Microsoft.Hosting.Lifetime": "Information"
    }
  },
  "AllowedHosts": "*",
  "ConnectionStrings": { "DefaultConnection": "server=.; database=GastroDB; user id=sa; password=123;" }
}


My publish settings: enter image description here

My iis settings: enter image description here

enter image description here

enter image description here

Paylaşılmıyor = Dont share enter image description here

Yetkilendirme = authority enter image description here

My Error :

Application '/LM/W3SVC/1/ROOT' with physical root 'C:\Users\Tuğçe\Desktop\iisDeneme\EcommerceGastro.API\bin\Release\net5.0\publish\' failed to load coreclr. Exception message:
CLR worker thread exited prematurely
Application '/LM/W3SVC/1/ROOT' with physical root 'C:\Users\Tuğçe\Desktop\iisDeneme\EcommerceGastro.API\bin\Release\net5.0\publish\' has exited from Program.Main with exit code = '0'. Please check the stderr logs for more information.

And i browse this iis web app its open but look like :

HTTP Error 500.30 - ASP.NET Core app failed to start
Common solutions to this issue:
The app failed to start
The app started but then stopped
The app 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
For more information visit: https://go.microsoft.com/fwlink/?LinkID=2028265
over 4 years ago · Santiago Trujillo
4 Respuestas
Responde la pregunta

0

The most common and easiest way to resolve this error is to re-publish your code, but with the options to "Remove additional files at destination" turned on. This will ensure that Visual Studio’s web deploy process will delete all existing files from the Web App before copying over the new code files. This will result in only the necessary files being published will exist in the Web App file system after the publish has completed. It also ensures that all files are overwritten with the newest versions; in case that may be interfering somehow as well.

To enable the Remove additional files at destination setting, click Edit on the Publish Profile within Visual Studio. The setting is located on the Settings tab underneath the File Publish Options expandable area. Check the box to enable the feature, then click Save.

over 4 years ago · Santiago Trujillo Denunciar

0

If you are in the debugging mode (visual studio) just clean the solution will solve the problem. In the production mode (IIS), first of all, clean the solution, publish the project, and replaced it with the previous one. (Make sure you will delete the whole previous folder and settings as @Samwu mentioned before)

over 4 years ago · Santiago Trujillo Denunciar

0

In my case, the problem was that it was running on a 32bit app pool, but the app was published as Framework-Dependent with a target runtime of win-x64. When I switched it to win-x86 my app started working, so then I looked into it and discovered the problem with the app pool. I made a new app pool, disabled 32bit, switched my app to that pool, and republished, and then it worked.

Edited to add: I had a second app display the same behavior for a different reason. In the second case, it was because I was using Serilog to write a log file to the app's root directory. But because the app pool did not have write permissions for that directory, it was failing and throwing the 500.30 error. Granting write permissions for the app pool on its directory solved the issue.

over 4 years ago · Santiago Trujillo Denunciar

0

In my case just update my code with this:

 public static void Main(string[] args)
        {
            CreateHostBuilder(args).Build().Run();
        }

        public static IHostBuilder CreateHostBuilder(string[] args) =>
            Host.CreateDefaultBuilder(args)
                .ConfigureWebHostDefaults(webBuilder =>
                {
                    webBuilder.UseStartup<Startup>();
                    
                });
    }

---Updating the explanation---

The Main method was without the Function: CreateHostBuilder(args).Build().Run(); for that reason my web application sent the error: HTTP Error 500.30 - ASP.NET Core app failed to start. Please take into consideration the below reference: Asp .Net Core Main Method!

over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda