.net core 3.1 中的 jsonRPC 模型绑定
jsonRPC model binding in .net core 3.1
我将我的项目升级到 .net core 3.1 并将 EdjCase.JsonRpc.Router 升级到 4.1.0
我试过邮递员的请求,每次请求体都是空的,升级后。
我加了
services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_3_0);
services.AddControllers()
.AddNewtonsoftJson(opt =>
{
opt.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver();
});
app.UseAuthentication();
app.UseRouting();
app.UseAuthorization();
app.UseEndpoints(endpoints =>
{
endpoints.MapControllers();
});
app.UseAuthentication()
.UseJsonRpc();
如何解决 jsonRPC 微服务中的模型绑定问题?
我在配置中解决了这个问题
public void ConfigureServices(IServiceCollection services)
{
services.AddJsonRpc(opt =>
{
opt.JsonSerializerSettings = new JsonSerializerOptions() { PropertyNamingPolicy = JsonNamingPolicy.CamelCase };
});
}
我将我的项目升级到 .net core 3.1 并将 EdjCase.JsonRpc.Router 升级到 4.1.0
我试过邮递员的请求,每次请求体都是空的,升级后。
我加了
services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_3_0);
services.AddControllers()
.AddNewtonsoftJson(opt =>
{
opt.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver();
});
app.UseAuthentication();
app.UseRouting();
app.UseAuthorization();
app.UseEndpoints(endpoints =>
{
endpoints.MapControllers();
});
app.UseAuthentication()
.UseJsonRpc();
如何解决 jsonRPC 微服务中的模型绑定问题?
我在配置中解决了这个问题
public void ConfigureServices(IServiceCollection services)
{
services.AddJsonRpc(opt =>
{
opt.JsonSerializerSettings = new JsonSerializerOptions() { PropertyNamingPolicy = JsonNamingPolicy.CamelCase };
});
}