程序问答   发布时间:2022-06-01  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了ASP .NET Core IIS 部署 IIS AspNetCore 模块错误:CLR 工作线程过早退出大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。

如何解决ASP .NET Core IIS 部署 IIS AspNetCore 模块错误:CLR 工作线程过早退出?

开发过程中遇到ASP .NET Core IIS 部署 IIS AspNetCore 模块错误:CLR 工作线程过早退出的问题如何解决?下面主要结合日常开发的经验,给出你关于ASP .NET Core IIS 部署 IIS AspNetCore 模块错误:CLR 工作线程过早退出的解决方法建议,希望对你解决ASP .NET Core IIS 部署 IIS AspNetCore 模块错误:CLR 工作线程过早退出有所启发或帮助;

我为 IIS 提供了 windows 中的所有功能,但如果您有任何建议,请与我分享。无论如何,我想部署在 IIS Lan 服务器上。但我不能。我工作了两天这个问题。我不知道如何解决这个问题。我使用“.net.5.0”。 我的应用程序代码是这样的

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();
    }  
}

启动

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;" }
}


我的发布设置:

ASP .NET Core IIS 部署 IIS AspNetCore 模块错误:CLR 工作线程过早退出

我的 IIS 设置:

ASP .NET Core IIS 部署 IIS AspNetCore 模块错误:CLR 工作线程过早退出

ASP .NET Core IIS 部署 IIS AspNetCore 模块错误:CLR 工作线程过早退出

ASP .NET Core IIS 部署 IIS AspNetCore 模块错误:CLR 工作线程过早退出

Paylaşılmıyor = 不要分享

ASP .NET Core IIS 部署 IIS AspNetCore 模块错误:CLR 工作线程过早退出

Yetkilendirme = 权威

ASP .NET Core IIS 部署 IIS AspNetCore 模块错误:CLR 工作线程过早退出

我的错误:

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.

我浏览了这个 IIS 网络应用程序,它是打开的,但看起来像:

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

解决方法

解决此错误的最常见和最简单的方法是重新发布您的代码,但要启用“在目标位置删除其他文件”选项。这将确保 Visual studio 的 Web 部署过程会在复制新代码文件之前从 Web 应用程序中删除所有现有文件。这将导致在发布完成后,Web App 文件系统中仅存在需要发布的文件。它还确保所有文件都被最新版本覆盖;以防万一这也可能以某种方式干扰。

要启用在目标位置删除其他文件设置,请单击 Visual studio 中发布配置文件上的编辑。该设置位于文件发布选项可扩展区域下方的设置选项卡上。选中复选框以启用该功能,然后点击保存。

,

如果您处于调试模式(visual studio),只需清理解决方案即可解决问题。 在生产模式(IIS)下,首先清理解决方案,发布项目,替换为之前的。 (确保您将删除之前提到的整个文件夹和设置@Samwu

,

就我而言,问题在于它在 32 位应用程序池上运行,但应用程序发布为 Framework-Dependent,目标运行时为 win-x64。当我将它切换到 win-x86 时,我的应用程序开始工作,所以我查看了它并发现了应用程序池的问题。我创建了一个新的应用程序池,禁用了 32 位,将我的应用程序切换到该池,然后重新发布,然后它就可以工作了。

大佬总结

以上是大佬教程为你收集整理的ASP .NET Core IIS 部署 IIS AspNetCore 模块错误:CLR 工作线程过早退出全部内容,希望文章能够帮你解决ASP .NET Core IIS 部署 IIS AspNetCore 模块错误:CLR 工作线程过早退出所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。