我跟随Scott Allen在Ubuntu 16.04 .Net Core 1.0.0框架中的Asp.Net核心复数课程.我无法在StartUp.cs文件中的Configure方法中找到app.UseRuntimeInfoPage方法,即使我已包含Microsoft.AspNetCore.Diagnostics.在提供的功能方面,框架是否对非Windows操作系统有限制?
来自Scott Allens课程的StartUp.cs代码
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/af19899927516718bdc05507612dcc17901fb937
我不提供代码示例,因为代码在上面提到的提交中.
| 归档时间: |
|
| 查看次数: |
2586 次 |
| 最近记录: |