【问题标题】:when I published asp net core 5 project on IIS it has an error当我在 IIS 上发布 asp net core 5 项目时出现错误
【发布时间】:2021-05-05 18:33:56
【问题描述】:

当我在 Visual Studio 2019 中运行我的项目时很好,但是当我在 IIS 上发布我的项目时发生错误。

An unhandled exception occurred while processing the request.
NullReferenceException: Object reference not set to an instance of an object.

我正在使用 mediatr 5 层清洁; 我在启动时注册了 MediatR,但错误没有解决。

 services.AddMediatR(typeof(YarnSystemCommandDTO).GetTypeInfo().Assembly);
 services.AddScoped(typeof(IGenericRepository<>), typeof(GenericRepository<>));

【问题讨论】:

    标签: c# iis asp.net-core-webapi publish mediatr


    【解决方案1】:

    为了调试这种情况,第一次机会异常的调用堆栈将最喜欢帮助。一种简单的方法是在应用程序的入口点引入一分钟延迟,这样您就有时间附加到 w3wp 进程以在启动时捕获异常。确保禁用“仅我的代码”。

    【讨论】:

      【解决方案2】:

      问题与 Db 连接有关,我在数据库中添加了用户访问权限:'IIS APPPOOL\tqcApi'

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2021-07-21
        • 2022-01-04
        • 1970-01-01
        • 2017-08-03
        • 2016-07-27
        • 1970-01-01
        相关资源
        最近更新 更多