I'm following Scott Allen's Asp.Net core Pluralsight course in Ubuntu 16.04 .Net Core 1.0.0 framework. I'm unable to find the app.UseRuntimeInfoPage method in Configure method in StartUp.cs file, even though I have included Microsoft.AspNetCore.Diagnostics. Does the framework have limitations for the non-windows operating systems in terms of the features provided?
StartUp.cs code from Scott Allen's course
using Microsoft.AspNet.Builder;
using Microsoft.AspNet.Hosting;
using Microsoft.AspNet.Http;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Configuration;
using OdeToFood.Services;
namespace OdeToFood
{
public class Startup
{
public Startup()
{
var builder = new ConfigurationBuilder()
.AddJsonFile("appsettings.json");
Configuration = builder.Build();
}
public IConfiguration Configuration { get; set; }
// This method gets called by the runtime. Use this method to add services to the container.
// For more information on how to configure your application, visit http://go.microsoft.com/fwlink/?LinkID=398940
public void ConfigureServices(IServiceCollection services)
{
services.AddMvc();
services.AddSingleton(provider => Configuration);
services.AddSingleton<IGreeter, Greeter>();
}
// This method gets called by the runtime.
// Use this method to configure the HTTP request pipeline.
public void Configure(
IApplicationBuilder app,
IHostingEnvironment environment,
IGreeter greeter)
{
app.UseIISPlatformHandler();
if (environment.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
app.UseRuntimeInfoPage("/info");
app.UseFileServer();
app.UseMvcWithDefaultRoute();
app.Run(async (context) =>
{
var greeting = greeter.GetGreeting();
await context.Response.WriteAsync(greeting);
});
}
// Entry point for the application.
public static void Main(string[] args) => WebApplication.Run<Startup>(args);
}
}
With ASP.NET Core 6.0 projects, you will not find Startup. cs file. By default, this file is removed and Program. cs is the new place where you need to register your dependencies and Middleware.
The Configure method is used to specify how the app responds to HTTP requests. The request pipeline is configured by adding middleware components to an IApplicationBuilder instance. IApplicationBuilder is available to the Configure method, but it isn't registered in the service container.
The Startup class contains the ConfigureServices and Configure methods. While the former is used to configure the required services, the latter is used to configure the request processing pipeline. The Configure method is executed immediately after the ConfigureServices method.
The Configure method is a place where you can configure application request pipeline for your application using IApplicationBuilder instance that is provided by the built-in IoC container.
This feature was removed some time ago. https://github.com/aspnet/Home/issues/1632
Also, it seems like it is scheduled to come back at an undetermined moment in time. https://github.com/aspnet/Diagnostics/issues/280
So for now you can remove it from your startup.cs; or add the code and create your own version of it from this commit: https://github.com/aspnet/Diagnostics/commit/af19899927516718bdc05507612dcc17901fb937
I do not provide a code sample because the code is in the commit mentioned above.
UPDATE:
It seems like issue #280 has been updated to state that the feature will not be brought back at all.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With