Giter VIP home page Giter VIP logo

surgingdemo's People

Contributors

billyang avatar yahue avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

surgingdemo's Issues

Program.cs(19,21): error CS0017: 程序定义了多个入口点

之前能dotnet run 正常运行
今天无修改,dotnet run 报了以下错误
Program.cs(19,21): error CS0017: 程序定义了多个入口点。使用 /main (指定包含入口点的类型)进行编译。 [f:\dotnet\SurgingDemo\src\Bill.Demo.Solutions\Bill.Demo.Services.Server\Bill.Demo.Services.Server.csproj]

有遇到过吗

dotnet run 服务项目异常

具体信息:
应用程序启动异常: System.InvalidOperationException: Unable to resolve service for type 'Microsoft.Extensions.Configuration.IConfigurationBuilder' while attempting to activate 'Bill.Demo.Services.Server.Startup'.
at Microsoft.Extensions.Internal.ActivatorUtilities.ConstructorMatcher.CreateInstance(IServiceProvider provider)
at Microsoft.Extensions.Internal.ActivatorUtilities.CreateInstance(IServiceProvider provider, Type instanceType, Object[] parameters)
at Surging.Core.ServiceHosting.Internal.Implementation.StartupLoader.LoadMethods(IServiceProvider hostingServiceProvider, Type startupType, String environmentName)
at Surging.Core.ServiceHosting.ServiceHostBuilderExtensions.<>c__DisplayClass0_0.b__1(IServiceProvider sp)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitFactory(FactoryCallSite factoryCallSite, ServiceProvider provider)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor2.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.CallSiteVisitor2.VisitCallSite(IServiceCallSite callSite, TArgument argument)
at Microsoft.Extensions.DependencyInjection.ServiceProvider.<>c__DisplayClass22_0.b__0(ServiceProvider provider)
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 Surging.Core.ServiceHosting.Internal.Implementation.ServiceHost.EnsureStartup()
at Surging.Core.ServiceHosting.Internal.Implementation.ServiceHost.EnsureApplicationServices()
at Surging.Core.ServiceHosting.Internal.Implementation.ServiceHost.BuildApplication()

Unhandled Exception: System.InvalidOperationException: Unable to resolve service for type 'Microsoft.Extensions.Configuration.IConfigurationBuilder' while attempting to activate 'Bill.Demo.Services.Server.Startup'.
at Microsoft.Extensions.Internal.ActivatorUtilities.ConstructorMatcher.CreateInstance(IServiceProvider provider)
at Microsoft.Extensions.Internal.ActivatorUtilities.CreateInstance(IServiceProvider provider, Type instanceType, Object[] parameters)
at Surging.Core.ServiceHosting.Internal.Implementation.StartupLoader.LoadMethods(IServiceProvider hostingServiceProvider, Type startupType, String environmentName)
at Surging.Core.ServiceHosting.ServiceHostBuilderExtensions.<>c__DisplayClass0_0.b__1(IServiceProvider sp)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitFactory(FactoryCallSite factoryCallSite, ServiceProvider provider)
at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor2.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.CallSiteVisitor2.VisitCallSite(IServiceCallSite callSite, TArgument argument)
at Microsoft.Extensions.DependencyInjection.ServiceProvider.<>c__DisplayClass22_0.b__0(ServiceProvider provider)
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 Surging.Core.ServiceHosting.Internal.Implementation.ServiceHost.EnsureStartup()
at Surging.Core.ServiceHosting.Internal.Implementation.ServiceHost.EnsureApplicationServices()
at Surging.Core.ServiceHosting.Internal.Implementation.ServiceHost.BuildApplication()
at Surging.Core.ServiceHosting.Internal.Implementation.ServiceHostBuilder.Build()
at Bill.Demo.Services.Server.Program.Main(String[] args) in f:\code template\SurgingDemo\src\Bill.Demo.Solutions\Bill.Demo.Services.Server\Program.cs:line 23

Value cannot be null. Parameter name: config

运行Bill.Demo.Services.Server时,在ServiceHostBuilderExtensions.UseLog4net报错:
Value cannot be null.
Parameter name: config
at Microsoft.Extensions.Options.ConfigurationChangeTokenSource1..ctor(String name, IConfiguration config) at Microsoft.Extensions.Logging.LoggingBuilderExtensions.AddConfiguration(ILoggingBuilder builder, IConfiguration configuration) at Surging.Core.Log4net.ServiceHostBuilderExtensions.<>c.<UseLog4net>b__0_0(ILoggingBuilder logger) in D:\microservice\surging\src\Surging.Core\Surging.Core.Log4net\ServiceHostBuilderExtensions.cs:line 15 at Microsoft.Extensions.DependencyInjection.LoggingServiceCollectionExtensions.AddLogging(IServiceCollection services, Action1 configure)
at Surging.Core.ServiceHosting.Internal.Implementation.ServiceHostBuilder.Build() in D:\microservice\surging\src\Surging.Core\Surging.Core.ServiceHosting\Internal\Implementation\ServiceHostBuilder.cs:line 34
at Bill.Demo.Services.Server.Program.Main(String[] args) in D:\microservice\SurgingDemo\src\Bill.Demo.Solutions\Bill.Demo.Services.Server\Program.cs:line 24

我发现这个问题是在host.Build()的时候调用了
})
.UseStartup()
.Build();

        using (host.Run())
        {
            Console.WriteLine($"服务端启动成功,{DateTime.Now}。");
        }

但是这个Configuration是在host.Run()初始化的。
而host.Run()在Build()后执行,所以报了个null的错误。

作者方便解答下这个该怎么解决吗?

运行Server的时候报错

Unhandled Exception: System.ArgumentNullException: Value cannot be null. Parameter name: config at Microsoft.Extensions.Options.ConfigurationChangeTokenSource1..ctor(String name, IConfiguration config)
at Microsoft.Extensions.Logging.LoggingBuilderExtensions.AddConfiguration(ILoggingBuilder builder, IConfiguration configuration)`

调试的时候,发现是UseLog4net("Configs/log4net.config")报出来的。
跟进去,发现是CPlatform.AppConfig中的Configuration为null,导致CPlatform.AppConfig.GetSection("Logging")为null。

请问,这个问题是如何解决的呢?
我是使用了最新版本的Surging.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.