0
我在Ubuntu服務器(16.04.1 LTS(GNU/Linux 4.4.0-97-generic x86_64))中提供了幾個aspnet核心應用程序,這些應用程序總是工作得很好,它們是webapi配置非常類似,但昨天我有一個問題發佈其中之一(只有一個像魅力其他工作),我收到一個錯誤,說實話我不明白主要是因爲我不記得做過任何與錯誤信息相關的變化,我浪費了很多小時,而且我會瘋狂。我最近將aspnet核心版本從1.1升級到2.0。在Ubuntu服務器中部署AspNet核心問題
這是我的Program.cs
public class Program
{
public static void Main(string[] args)
{
Console.Title = "Webtools Service";
BuildWebHost(args).Run();
}
public static IWebHost BuildWebHost(string[] args)
{
var config = new ConfigurationBuilder()
.SetBasePath(Directory.GetCurrentDirectory())
.AddJsonFile("hosting.json", true)
.Build();
return WebHost.CreateDefaultBuilder(args)
.UseKestrel()
.UseConfiguration(config)
.ConfigureAppConfiguration((hostContext, conf) =>
{
var env = hostContext.HostingEnvironment;
// delete all default configuration providers
conf.Sources.Clear();
conf.SetBasePath(env.ContentRootPath);
conf.AddJsonFile("appsettings.json", optional: false, reloadOnChange: true);
conf.AddJsonFile("appsettings.local.overrides.json", optional: true);
conf.AddEnvironmentVariables();
})
.UseContentRoot(Directory.GetCurrentDirectory())
.UseIISIntegration()
.UseStartup<Startup>()
//.UseApplicationInsights()
.Build();
}
}
我附上錯誤跟蹤:
> info:
> Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager[0]
> User profile is available. Using '/home/ubuntu/.aspnet/DataProtection-Keys' as key repository; keys
> will not be encrypted at rest. Application startup exception:
> System.PlatformNotSupportedException: Windows Principal functionality
> is not supported on this platform. at
> System.Security.Principal.WindowsIdentity.GetCurrent() at
> Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel.Implementation.ApplicationFolderProvider..ctor(IDictionary
> environment, String folderName) at
> Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel.Implementation.Transmitter.Initialize()
> at
> Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel.ServerTelemetryChannel.Initialize(TelemetryConfiguration
> configuration) at
> Microsoft.Extensions.DependencyInjection.TelemetryConfigurationOptionsSetup.Configure(TelemetryConfiguration
> configuration) at
> Microsoft.Extensions.DependencyInjection.TelemetryConfigurationOptions..ctor(IEnumerable`1
> configureOptions)
> --- End of stack trace from previous location where exception was thrown --- at
> System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at
> Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite
> constructorCallSite, ServiceProvider provider) at
> Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(IServiceCallSite
> callSite, TArgument argument) at
> Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite
> scopedCallSite, ServiceProvider provider) at
> Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitSingleton(SingletonCallSite
> singletonCallSite, ServiceProvider provider) at
> Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(IServiceCallSite
> callSite, TArgument argument) at
> Microsoft.Extensions.DependencyInjection.ServiceProvider.<>c__DisplayClass22_0.<RealizeService>b__0(ServiceProvider
> provider) at
> Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(Type
> serviceType) at
> Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetService[T](IServiceProvider
> provider) at
> Microsoft.Extensions.DependencyInjection.ApplicationInsightsExtensions.<>c.<AddApplicationInsightsTelemetry>b__13_1(IServiceProvider
> provider) at
> Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitFactory(FactoryCallSite
> factoryCallSite, ServiceProvider provider) at
> Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(IServiceCallSite
> callSite, TArgument argument) at
> Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite
> scopedCallSite, ServiceProvider provider) at
> Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitSingleton(SingletonCallSite
> singletonCallSite, ServiceProvider provider) at
> Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(IServiceCallSite
> callSite, TArgument argument) at
> Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite
> constructorCallSite, ServiceProvider provider) at
> Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(IServiceCallSite
> callSite, TArgument argument) at
> Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite
> scopedCallSite, ServiceProvider provider) at
> Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitSingleton(SingletonCallSite
> singletonCallSite, ServiceProvider provider) at
> Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(IServiceCallSite
> callSite, TArgument argument) at
> Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite
> constructorCallSite, ServiceProvider provider) at
> Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(IServiceCallSite
> callSite, TArgument argument) at
> Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite
> scopedCallSite, ServiceProvider provider) at
> Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitSingleton(SingletonCallSite
> singletonCallSite, ServiceProvider provider) at
> Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(IServiceCallSite
> callSite, TArgument argument) at
> Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitIEnumerable(IEnumerableCallSite
> enumerableCallSite, ServiceProvider provider) at
> Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(IServiceCallSite
> callSite, TArgument argument) at
> Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite
> constructorCallSite, ServiceProvider provider) at
> Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(IServiceCallSite
> callSite, TArgument argument) at
> Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite
> scopedCallSite, ServiceProvider provider) at
> Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitSingleton(SingletonCallSite
> singletonCallSite, ServiceProvider provider) at
> Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(IServiceCallSite
> callSite, TArgument argument) at
> Microsoft.Extensions.DependencyInjection.ServiceProvider.<>c__DisplayClass22_0.<RealizeService>b__0(ServiceProvider
> provider) at
> Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(Type
> serviceType) at
> Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetService[T](IServiceProvider
> provider) at
> Microsoft.ApplicationInsights.AspNetCore.ApplicationInsightsStartupFilter.<>c__DisplayClass0_0.<Configure>b__0(IApplicationBuilder
> app) at
> Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication() crit:
> Microsoft.AspNetCore.Hosting.Internal.WebHost[6]
> Application startup exception System.PlatformNotSupportedException: Windows Principal functionality
> is not supported on this platform. at
> System.Security.Principal.WindowsIdentity.GetCurrent() at
> Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel.Implementation.ApplicationFolderProvider..ctor(IDictionary
> environment, String folderName) at
> Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel.Implementation.Transmitter.Initialize()
> at
> Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel.ServerTelemetryChannel.Initialize(TelemetryConfiguration
> configuration) at
> Microsoft.Extensions.DependencyInjection.TelemetryConfigurationOptionsSetup.Configure(TelemetryConfiguration
> configuration) at
> Microsoft.Extensions.DependencyInjection.TelemetryConfigurationOptions..ctor(IEnumerable`1
> configureOptions)
> --- End of stack trace from previous location where exception was thrown --- at
> System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at
> Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite
> constructorCallSite, ServiceProvider provider) at
> Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(IServiceCallSite
> callSite, TArgument argument) at
> Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite
> scopedCallSite, ServiceProvider provider) at
> Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitSingleton(SingletonCallSite
> singletonCallSite, ServiceProvider provider) at
> Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(IServiceCallSite
> callSite, TArgument argument) at
> Microsoft.Extensions.DependencyInjection.ServiceProvider.<>c__DisplayClass22_0.<RealizeService>b__0(ServiceProvider
> provider) at
> Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(Type
> serviceType) at
> Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetService[T](IServiceProvider
> provider) at
> Microsoft.Extensions.DependencyInjection.ApplicationInsightsExtensions.<>c.<AddApplicationInsightsTelemetry>b__13_1(IServiceProvider
> provider) at
> Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitFactory(FactoryCallSite
> factoryCallSite, ServiceProvider provider) at
> Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(IServiceCallSite
> callSite, TArgument argument) at
> Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite
> scopedCallSite, ServiceProvider provider) at
> Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitSingleton(SingletonCallSite
> singletonCallSite, ServiceProvider provider) at
> Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(IServiceCallSite
> callSite, TArgument argument) at
> Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite
> constructorCallSite, ServiceProvider provider) at
> Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(IServiceCallSite
> callSite, TArgument argument) at
> Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite
> scopedCallSite, ServiceProvider provider) at
> Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitSingleton(SingletonCallSite
> singletonCallSite, ServiceProvider provider) at
> Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(IServiceCallSite
> callSite, TArgument argument) at
> Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite
> constructorCallSite, ServiceProvider provider) at
> Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(IServiceCallSite
> callSite, TArgument argument) at
> Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite
> scopedCallSite, ServiceProvider provider) at
> Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitSingleton(SingletonCallSite
> singletonCallSite, ServiceProvider provider) at
> Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(IServiceCallSite
> callSite, TArgument argument) at
> Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitIEnumerable(IEnumerableCallSite
> enumerableCallSite, ServiceProvider provider) at
> Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(IServiceCallSite
> callSite, TArgument argument) at
> Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite
> constructorCallSite, ServiceProvider provider) at
> Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(IServiceCallSite
> callSite, TArgument argument) at
> Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite
> scopedCallSite, ServiceProvider provider) at
> Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitSingleton(SingletonCallSite
> singletonCallSite, ServiceProvider provider) at
> Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(IServiceCallSite
> callSite, TArgument argument) at
> Microsoft.Extensions.DependencyInjection.ServiceProvider.<>c__DisplayClass22_0.<RealizeService>b__0(ServiceProvider
> provider) at
> Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(Type
> serviceType) at
> Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetService[T](IServiceProvider
> provider) at
> Microsoft.ApplicationInsights.AspNetCore.ApplicationInsightsStartupFilter.<>c__DisplayClass0_0.<Configure>b__0(IApplicationBuilder
> app) at
> Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication()
>
> Unhandled Exception: System.PlatformNotSupportedException: Windows
> Principal functionality is not supported on this platform. at
> System.Security.Principal.WindowsIdentity.GetCurrent() at
> Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel.Implementation.ApplicationFolderProvider..ctor(IDictionary
> environment, String folderName) at
> Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel.Implementation.Transmitter.Initialize()
> at
> Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel.ServerTelemetryChannel.Initialize(TelemetryConfiguration
> configuration) at
> Microsoft.Extensions.DependencyInjection.TelemetryConfigurationOptionsSetup.Configure(TelemetryConfiguration
> configuration) at
> Microsoft.Extensions.DependencyInjection.TelemetryConfigurationOptions..ctor(IEnumerable`1
> configureOptions)
> --- End of stack trace from previous location where exception was thrown --- at
> System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at
> Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite
> constructorCallSite, ServiceProvider provider) at
> Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(IServiceCallSite
> callSite, TArgument argument) at
> Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite
> scopedCallSite, ServiceProvider provider) at
> Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitSingleton(SingletonCallSite
> singletonCallSite, ServiceProvider provider) at
> Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(IServiceCallSite
> callSite, TArgument argument) at
> Microsoft.Extensions.DependencyInjection.ServiceProvider.<>c__DisplayClass22_0.<RealizeService>b__0(ServiceProvider
> provider) at
> Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(Type
> serviceType) at
> Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetService[T](IServiceProvider
> provider) at
> Microsoft.Extensions.DependencyInjection.ApplicationInsightsExtensions.<>c.<AddApplicationInsightsTelemetry>b__13_1(IServiceProvider
> provider) at
> Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitFactory(FactoryCallSite
> factoryCallSite, ServiceProvider provider) at
> Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(IServiceCallSite
> callSite, TArgument argument) at
> Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite
> scopedCallSite, ServiceProvider provider) at
> Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitSingleton(SingletonCallSite
> singletonCallSite, ServiceProvider provider) at
> Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(IServiceCallSite
> callSite, TArgument argument) at
> Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite
> constructorCallSite, ServiceProvider provider) at
> Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(IServiceCallSite
> callSite, TArgument argument) at
> Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite
> scopedCallSite, ServiceProvider provider) at
> Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitSingleton(SingletonCallSite
> singletonCallSite, ServiceProvider provider) at
> Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(IServiceCallSite
> callSite, TArgument argument) at
> Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite
> constructorCallSite, ServiceProvider provider) at
> Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(IServiceCallSite
> callSite, TArgument argument) at
> Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite
> scopedCallSite, ServiceProvider provider) at
> Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitSingleton(SingletonCallSite
> singletonCallSite, ServiceProvider provider) at
> Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(IServiceCallSite
> callSite, TArgument argument) at
> Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitIEnumerable(IEnumerableCallSite
> enumerableCallSite, ServiceProvider provider) at
> Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(IServiceCallSite
> callSite, TArgument argument) at
> Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite
> constructorCallSite, ServiceProvider provider) at
> Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(IServiceCallSite
> callSite, TArgument argument) at
> Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite
> scopedCallSite, ServiceProvider provider) at
> Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitSingleton(SingletonCallSite
> singletonCallSite, ServiceProvider provider) at
> Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor`2.VisitCallSite(IServiceCallSite
> callSite, TArgument argument) at
> Microsoft.Extensions.DependencyInjection.ServiceProvider.<>c__DisplayClass22_0.<RealizeService>b__0(ServiceProvider
> provider) at
> Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(Type
> serviceType) at
> Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetService[T](IServiceProvider
> provider) at
> Microsoft.ApplicationInsights.AspNetCore.ApplicationInsightsStartupFilter.<>c__DisplayClass0_0.<Configure>b__0(IApplicationBuilder
> app) at
> Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication() at
> Microsoft.AspNetCore.Hosting.WebHostBuilder.Build() at
> WebtoolsService.Program.BuildWebHost(String[] args) in
> /var/NetWebApps/sources/Program.cs:line 26 at
> WebtoolsService.Program.Main(String[] args) in
> /var/NetWebApps/sources/Program.cs:line 16