Ao tentar criar um ambiente web de desenvolvimento ocorreu a seguinte falha no console:
static void Main(string[] args)
{
var _repo = new LivroRepositorioCSV();
IWebHost host = new WebHostBuilder()
.UseKestrel()
.UseStartup<StartupDevelopment>()
.Build();
host.Run();
//ImprimeLista(_repo.ParaLer);
//ImprimeLista(_repo.Lendo);
//ImprimeLista(_repo.Lidos);
}
public class StartupDevelopment
{
public void ConfigureDevelopment(IApplicationBuilder app)
{
app.Run(LivrosParaLer);
}
public Task LivrosParaLer(HttpContext context)
{
//HttpContext contexto = new HttpContext(); // toda informação http é incapsulada dessa classe
var _repo = new LivroRepositorioCSV();
return context.Response.WriteAsync(_repo.ParaLer.ToString()); // para escrever
}
}
**Application startup exception: System.InvalidOperationException: A public method named 'ConfigureProduction' or 'Configure' could not be found in the 'Alura.ListaLeitura.App.StartupDevelopment' type. at Microsoft.AspNetCore.Hosting.Internal.StartupLoader.FindMethod(Type startupType, String methodName, String environmentName, Type returnType, Boolean required) at Microsoft.AspNetCore.Hosting.Internal.StartupLoader.FindConfigureDelegate(Type startupType, String environmentName) at Microsoft.AspNetCore.Hosting.Internal.StartupLoader.LoadMethods(IServiceProvider hostingServiceProvider, Type startupType, String environmentName) at Microsoft.AspNetCore.Hosting.WebHostBuilderExtensions.<>c__DisplayClass1_0.b__1(IServiceProvider sp) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite, ServiceProvider provider) at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType) at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[T](IServiceProvider provider) at Microsoft.AspNetCore.Hosting.Internal.WebHost.EnsureStartup() at Microsoft.AspNetCore.Hosting.Internal.WebHost.EnsureApplicationServices() at Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication()
Unhandled Exception: System.InvalidOperationException: A public method named 'ConfigureProduction' or 'Configure' could not be found in the 'Alura.ListaLeitura.App.StartupDevelopment' type. at Microsoft.AspNetCore.Hosting.Internal.StartupLoader.FindMethod(Type startupType, String methodName, String environmentName, Type returnType, Boolean required) at Microsoft.AspNetCore.Hosting.Internal.StartupLoader.FindConfigureDelegate(Type startupType, String environmentName) at Microsoft.AspNetCore.Hosting.Internal.StartupLoader.LoadMethods(IServiceProvider hostingServiceProvider, Type startupType, String environmentName) at Microsoft.AspNetCore.Hosting.WebHostBuilderExtensions.<>c__DisplayClass1_0.b__1(IServiceProvider sp) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitScoped(ScopedCallSite scopedCallSite, ServiceProvider provider) at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType) at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[T](IServiceProvider provider) at Microsoft.AspNetCore.Hosting.Internal.WebHost.EnsureStartup() at Microsoft.AspNetCore.Hosting.Internal.WebHost.EnsureApplicationServices() at Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication() at Microsoft.AspNetCore.Hosting.WebHostBuilder.Build() at Alura.ListaLeitura.App.Program.Main(String[] args) in C:\Users\genilson.maceno\Dropbox\C-Sharp\Asp.NET Core\Alura.ListaLeitura\Alura.ListaLeitura.App\Program.cs:line 14
O C:\Program Files\dotnet\dotnet.exe (processo 17028) foi encerrado com o código -532462766. Pressione qualquer tecla para fechar esta janela...**