我正在尝试通过以下指南将应用程序见解添加到项目中。 https://docs.microsoft.com/en-us/azure/service-fabric/service-fabric-tutorial-monitoring-aspnet
我的项目是服务结构服务=> .net框架=>无状态asp.net核心,如下所示:
包含该项目的服务结构已经工作并且已经发布。 现在,当我添加应用程序见解并在本地运行服务结构时,它将被编译并运行,但是asp.net服务未运行。 在启动服务结构大约一分钟后的诊断事件中,出现以下运行状况报告错误堆栈跟踪,其中声明了basePath的空引用:
{
"Timestamp": "2019-04-23T14:01:00.9644622+03:00",
"ProviderName": "Microsoft-ServiceFabric",
"Id": 54430,
"Message": "EventName: StatelessReplicaNewHealthReport Category: Health Partition=4d20cbee-372e-42d1-952e-738538152b1e StatelessInstance=132004907032061609 SourceId=System.RA Property=ReplicaOpenStatus HealthState=Warning TTL=922337203685477ms SequenceNumber=132004908536921071 Description='Replica had multiple failures during open on _Node_0. API call: IStatelessServiceInstance.Open(); Error = System.ArgumentNullException (-2147467261)
Value cannot be null.
Parameter name: basePath
at Microsoft.Extensions.Configuration.FileConfigurationExtensions.SetBasePath(IConfigurationBuilder builder, String basePath)
at Microsoft.AspNetCore.Hosting.DefaultApplicationInsightsServiceConfigureOptions.Configure(ApplicationInsightsServiceOptions options)
at Microsoft.Extensions.Options.OptionsFactory
1.Create(字符串名称)
在System.Lazy 1.CreateValue()
at System.Lazy
1.LazyInitValue()
在Microsoft.ApplicationInsights.AspNetCore.TelemetryInitializers.ComponentVersionTelemetryInitializer..ctor中(IOptions`1个选项)
---从之前引发异常的位置开始的堆栈结束跟踪---
在System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
在Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite构造函数CallSite,ServiceProviderEngineScope范围)
在Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite,ServiceProviderEngineScope范围)
在Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitIEnumerable(IEnumerableCallSite enumerableCallSite,ServiceProviderEngineScope范围)
在Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite构造函数CallSite,ServiceProviderEngineScope范围)
在Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite,ServiceProviderEngineScope范围)
在Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitIEnumerable(IEnumerableCallSite enumerableCallSite,ServiceProviderEngineScope范围)
在Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite构造函数CallSite,ServiceProviderEngineScope范围)
在Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite,ServiceProviderEngineScope范围)
在Microsoft.Extensions.DependencyInjection.ServiceLookup.DynamicServiceProviderEngine。<> c__DisplayClass1_0.b__0(ServiceProviderEngineScope范围)
在Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetService [T](IServiceProvider提供程序)
在Microsoft.Extensions.DependencyInjection.ApplicationInsightsExtensions。<> c.b__13_1(IServiceProvider提供程序)
在Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite,ServiceProviderEngineScope范围)
在Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite构造函数CallSite,ServiceProviderEngineScope范围)
在Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite,ServiceProviderEngineScope范围)
在Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite构造函数CallSite,ServiceProviderEngineScope范围)
在Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite,ServiceProviderEngineScope范围)
在Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitIEnumerable(IEnumerableCallSite enumerableCallSite,ServiceProviderEngineScope范围)
在Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite构造函数CallSite,ServiceProviderEngineScope范围)
在Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite,ServiceProviderEngineScope范围)
在Micro [Truncated]'RemoveWhenExpired = False SourceUTCTimestamp = 04/23/2019 14:00:53“,
“ ProcessId”:10100,
“级别”:“信息性”,
“关键字”:“ 0x4000000000000001”,
“ EventName”:“ HM”,
“ ActivityID”:null,
“ RelatedActivityID”:null,
“有效载荷”:{
“ eventName”:“ StatelessReplicaNewHealthReport”,
“类别”:“健康”,
“ eventInstanceId”:“ \” ae7ebe56-19d6-4c36-a6dd-5c12e9a3d36e \“”,
“ partitionId”:“ \” 4d20cbee-372e-42d1-952e-738538152b1e \“”,
“ replicaId”:132004907032061609,
“ sourceId”:“ System.RA”,
“属性”:“ ReplicaOpenStatus”,
“ healthState”:2
“ TTLtimespan”:922337203685477,
“ sequenceNumber”:132004908536921071
}
}
`
我尝试将ASP.NET核心配置注入ConfigureAppConfiguration方法内(由于本文https://marcinjuraszek.com/2018/10/asp-net-core-configuration-when-running-as-service-fabric-service.html),但它似乎设置了基本路径 用于asp.net核心配置,而不是应用程序见解。