dotnetcore / HttpReports

HttpReports is an APM (application performance monitor) system for .Net Core.
1.26k stars 242 forks source link

System.ArgumentOutOfRangeException #75

Closed NPUlrk closed 3 years ago

NPUlrk commented 3 years ago

在项目(ASP .NET Core 2.2)中参考这篇文档引用HttpReports启动报如下错误: System.ArgumentOutOfRangeException HResult=0x80131502 Message=Specified argument was out of the range of valid values. Arg_ParamName_Name Source=HttpReports.Core StackTrace: at HttpReports.DeferFlushCollection1..ctor(Int32 flushThreshold, Int32 flushSecond) at HttpReports.AsyncCallbackDeferFlushCollection1..ctor(Func3 callback, Int32 flushThreshold, Int32 flushSecond) at HttpReports.Transport.Http.HttpTransport..ctor(IOptions1 options, JsonSerializerOptions jsonSetting, ILogger1 logger, IHttpClientFactory httpClientFactory) at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, ServiceProviderEngineScope scope) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor2.VisitCallSite(IServiceCallSite callSite, TArgument argument) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite, ServiceProviderEngineScope scope) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitSingleton(SingletonCallSite singletonCallSite, ServiceProviderEngineScope scope) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor2.VisitCallSite(IServiceCallSite callSite, TArgument argument) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, ServiceProviderEngineScope scope) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor2.VisitCallSite(IServiceCallSite callSite, TArgument argument) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite, ServiceProviderEngineScope scope) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitSingleton(SingletonCallSite singletonCallSite, ServiceProviderEngineScope scope) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(IServiceCallSite callSite, TArgument argument) at Microsoft.Extensions.DependencyInjection.ServiceLookup.DynamicServiceProviderEngine.<>c__DisplayClass1_0.b__0(ServiceProviderEngineScope scope) at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngine.GetService(Type serviceType, ServiceProviderEngineScope serviceProviderEngineScope) at Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngine.GetService(Type serviceType) at Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(Type serviceType) at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType) at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[T](IServiceProvider provider) at Microsoft.Extensions.DependencyInjection.HttpReportsMiddlewareExtensions.UseHttpReports(IApplicationBuilder app) at DataStorageService.Startup.Configure(IApplicationBuilder app, IHostingEnvironment env) in F:\源代码管理\AIOps\DataStorageService\Startup.cs:line 76

SpringLeee commented 3 years ago

我用 Core 2.2 版本的测了下 ,没有报错,HttpReports 版本是 2.5.6,你检查下包有没有安装, 或者配置参数对不对

NPUlrk commented 3 years ago

我用 Core 2.2 版本的测了下 ,没有报错,HttpReports 版本是 2.5.6,你检查下包有没有安装, 或者配置参数对不对 HttpReports 已引用,版本:2.5.6 HttpReports.Transport.Http 已引用,版本:2.5.6 参数配置如下: { "$schema": "http://json.schemastore.org/launchsettings.json", "iisSettings": { "windowsAuthentication": false, "anonymousAuthentication": true, "iisExpress": { "applicationUrl": "http://localhost:5002", "sslPort": 5003 } }, "profiles": { "IIS Express": { "commandName": "IISExpress", "launchBrowser": true, "launchUrl": "swagger/index.html", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" } }, "DataStorageService": { "applicationUrl": "https://localhost:5001;http://localhost:5000", "commandName": "Project", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" }, "launchBrowser": true, "launchUrl": "swagger/index.html" } }, "HttpReports": { "Transport": { "CollectorAddress": "http://10.89.103.78:8014/", "DeferSecond": 10, "DeferThreshold": 10 }, "Server": "http://localhost:5000", "Service": "User", "Switch": true, "RequestFilter": [ "/api/health/", "/HttpReports" ], "WithRequest": true, "WithResponse": true, "WithCookie": true, "WithHeader": true } }

NPUlrk commented 3 years ago

尴尬,配置参数放错了,要放到appsetting里面,结果一不小心放到launchSetting里面了