services.Configure
if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); }
[HttpGet]
[ResponseCache(VaryByHeader = "Accept-Encoding", CacheProfileName = "CacheProfile")]
public async Task
services.AddResponseCompression(options =>
{
options.Providers.Add
"CacheProfiles": { "CacheProfile": { "Duration": 86400, "Location": ResponseCacheLocation.Any } }
解决了请求大小限制问题后,此方法能够更有效地处理大型JSON响应并避免返回“This localhost page can’t be found”错误。