关于C#:在aspnet core的startup.cs文件中找不到use.runtimepageinfo()方法

Unable to find Use.RunTimePageInfo() method in startup.cs file in aspnet core

斯科特在以下所有的ASP。NET的核心课程在Ubuntu pluralsight 1.0.0 16.04。NET框架的核心。在无法找到app.useruntimeinfopage法法startup.cs配置文件,即使我有microsoft.aspnetcore.diagnostics included。框架是有限制的非Windows操作系统提供的功能方面的?

从startup.cs斯科特艾伦的课程代码

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
    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();
            }

            // 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(args);
        }
    }


此功能在一段时间前被删除。https://github.com/aspnet/home/issues/1632

而且,它似乎是计划在一个不确定的时刻及时回来。https://github.com/aspnet/diagnostics/issues/280

因此,现在您可以将其从startup.cs中删除,或者添加代码并在此提交中创建自己的版本:https://github.com/aspnet/diagnostics/commit/af1989927516718bdc5507612dcc17901fb937

我不提供代码示例,因为代码在上面提到的提交中。


使用.runtimepageinfo()。没有这样的方法…

请显示启动代码