我是靠谱客的博主 细心小懒猪,最近开发中收集的这篇文章主要介绍Unable to resolve service for type 'Microsoft.AspNetCore.ResponseCompression.IResponseCompressionPro...,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

System.InvalidOperationException
HResult=0x80131509
Message=Unable to resolve service for type 'Microsoft.AspNetCore.ResponseCompression.IResponseCompressionProvider' while attempting to activate 'Microsoft.AspNetCore.ResponseCompression.ResponseCompressionMiddleware'.
Source=Microsoft.AspNetCore.Http.Abstractions
StackTrace:
at Microsoft.Extensions.Internal.ActivatorUtilities.ConstructorMatcher.CreateInstance(IServiceProvider provider)
at Microsoft.Extensions.Internal.ActivatorUtilities.CreateInstance(IServiceProvider provider, Type instanceType, Object[] parameters)
at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.<>c__DisplayClass4_0.<UseMiddleware>b__0(RequestDelegate next)
at Microsoft.AspNetCore.Builder.Internal.ApplicationBuilder.Build()
at Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication()
at Microsoft.AspNetCore.Hosting.Internal.WebHost.<StartAsync>d__26.MoveNext()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Hosting.WebHostExtensions.<RunAsync>d__5.MoveNext()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Hosting.WebHostExtensions.<RunAsync>d__4.MoveNext()
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNetCore.Hosting.WebHostExtensions.Run(IWebHost host)
at DL.AdminSite.Program.Main(String[] args) in E:ProjectDLDLDL.AdminSiteProgram.cs:line 17

 

 

类似这样的错误是指没有在ConfigureServices方法里面添加该中间件,就会出错

 

转载于:https://www.cnblogs.com/ingstyle/p/11555296.html

最后

以上就是细心小懒猪为你收集整理的Unable to resolve service for type 'Microsoft.AspNetCore.ResponseCompression.IResponseCompressionPro...的全部内容,希望文章能够帮你解决Unable to resolve service for type 'Microsoft.AspNetCore.ResponseCompression.IResponseCompressionPro...所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(41)

评论列表共有 0 条评论

立即
投稿
返回
顶部