BufferingHelper.EnableRewind();
Run Code Online (Sandbox Code Playgroud)
上面是ASP.NET Core 2.2中HttpRequest对象的扩展方法。ASP.NET Core 3.0(至少具有此名称)中没有更多内容。我想知道它在ASP.NET Core 3.0中是备用的。我不确定
HttpRequestRewindExtensions.EnableBuffering();
Run Code Online (Sandbox Code Playgroud)
是替代者。
我刚刚将项目从.net core 2.2迁移到3.0 Preview7。我在其中使用Swashbuckle.AspNetCore(v4.0.1)。这是我的入门班。
public class Startup
{
public IConfiguration Configuration { get; }
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
services.AddDbContext<ApplicationDbContext>(options =>
options.UseSqlServer(
Configuration["ConnectionStrings:ConnectionStringAzureSQL"]));
services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_3_0);
services.AddApplicationInsightsTelemetry();
services.AddLocalization(options => options.ResourcesPath = @"Resources");
services.AddMemoryCache();
services.Configure<RequestLocalizationOptions>(options =>
{
var supportedCultures = new List<CultureInfo>
{
new CultureInfo("en-US")
};
options.DefaultRequestCulture = new RequestCulture("en-US");
options.SupportedCultures = supportedCultures;
options.SupportedUICultures = supportedCultures;
});
services.AddSwaggerGen(c =>
{
c.SwaggerDoc("v1", new Info { Title = …Run Code Online (Sandbox Code Playgroud)