如果出现以下问题,一般从表面是无法找到错误根源。
解决方案:
1、先打开站点下面的web.config文件
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<location path="." inheritInChildApplications="false">
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath=".\WebApi.exe" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" hostingModel="OutOfProcess" />
</system.webServer>
</location>
</configuration>
<!--ProjectGuid: 2db5a0c4-8146-4ec6-981b-cb5df2052cee-->
修改
stdoutLogEnabled="false" 值设置为“true”
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<location path="." inheritInChildApplications="false">
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath=".\WebApi.exe" stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout" hostingModel="OutOfProcess" />
</system.webServer>
</location>
</configuration>
<!--ProjectGuid: 2db5a0c4-8146-4ec6-981b-cb5df2052cee-->
这样修改的目的就是为了生成错误日志方便我分析
下面就是我遇到的错误原因:
Unhandled exception. System.Exception: Repository.dll和service.dll 丢失,因为项目解耦了,所以需要先F6编译,再F5运行,请检查 bin 文件夹,并拷贝。
at Begon.Extensions.ServiceExtensions.AutofacModuleRegister.Load(ContainerBuilder builder) in I:\柏港网站集\柏港统一订单平台\BlazorApp\Begon.Extensions\ServiceExtensions\AutofacModuleRegister.cs:line 34
at Autofac.Module.Configure(IComponentRegistryBuilder componentRegistry)
at Autofac.Core.Registration.ModuleRegistrar.<.ctor>b__1_0(IComponentRegistryBuilder reg)
at Autofac.ContainerBuilder.Build(IComponentRegistryBuilder componentRegistry, Boolean excludeDefaultModules)
at Autofac.ContainerBuilder.Build(ContainerBuildOptions options)
at Autofac.Extensions.DependencyInjection.AutofacServiceProviderFactory.CreateServiceProvider(ContainerBuilder containerBuilder)
at Microsoft.Extensions.Hosting.Internal.ServiceFactoryAdapter`1.CreateServiceProvider(Object containerBuilder)
at Microsoft.Extensions.Hosting.HostBuilder.CreateServiceProvider()
at Microsoft.Extensions.Hosting.HostBuilder.Build()
at Microsoft.AspNetCore.Builder.WebApplicationBuilder.Build()
at Program.<Main>$(String[] args) in I:\柏港网站集\柏港统一订单平台\BlazorApp\WebApi\Program.cs:line 95
Unhandled exception. System.Exception: Repository.dll和service.dll 丢失,因为项目解耦了,所以需要先F6编译,再F5运行,请检查 bin 文件夹,并拷贝。
at Begon.Extensions.ServiceExtensions.AutofacModuleRegister.Load(ContainerBuilder builder) in I:\柏港网站集\柏港统一订单平台\BlazorApp\Begon.Extensions\ServiceExtensions\AutofacModuleRegister.cs:line 34
at Autofac.Module.Configure(IComponentRegistryBuilder componentRegistry)
at Autofac.Core.Registration.ModuleRegistrar.<.ctor>b__1_0(IComponentRegistryBuilder reg)
at Autofac.ContainerBuilder.Build(IComponentRegistryBuilder componentRegistry, Boolean excludeDefaultModules)
at Autofac.ContainerBuilder.Build(ContainerBuildOptions options)
at Autofac.Extensions.DependencyInjection.AutofacServiceProviderFactory.CreateServiceProvider(ContainerBuilder containerBuilder)
at Microsoft.Extensions.Hosting.Internal.ServiceFactoryAdapter`1.CreateServiceProvider(Object containerBuilder)
at Microsoft.Extensions.Hosting.HostBuilder.CreateServiceProvider()
at Microsoft.Extensions.Hosting.HostBuilder.Build()
at Microsoft.AspNetCore.Builder.WebApplicationBuilder.Build()
at Program.<Main>$(String[] args) in I:\柏港网站集\柏港统一订单平台\BlazorApp\WebApi\Program.cs:line 95
产生的原因就是在发布项目是原本解耦了的dll文件没有被一起发布,所以差文件DLL。
所以网上查到的一些解决方法根本无法解决自己的问题,这就说明了产生
HTTP Error 502.5
并不一定是。。。所以要看错误日志分析来解决。
Copyright © 广州京杭网络科技有限公司 2005-2024 版权所有 粤ICP备16019765号
广州京杭网络科技有限公司 版权所有