源码地址:WebSamples15/JsViewerSamples/JSViewer_MVC_Core at main · activereports/WebSamples15 · GitHub
前端post请求
后端修改
1、nuget引入 Microsoft.AspNetCore.Mvc.NewtonsoftJson;core3.1版本推荐3.1.x版本
2、Startup.cs调整
public void ConfigureServices(IServiceCollection services)
{
services.AddControllers().AddNewtonsoftJson(options =>
{
options.SerializerSettings.ContractResolver = new DefaultContractResolver(); //json用非驼峰
});
services
.AddLogging(config =>
{
// Disable the default logging configuration
config.ClearProviders();
// Enable logging for debug mode only
if (Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT") == Environments.Development)
{
config.AddConsole();
}
})
.AddReporting()
.AddMvc(options => options.EnableEndpointRouting = false);
}
|