.net core 常见问题解决办法

.NET Core动态属性(ExpandoObject)的json序列化

  • 问题描述:dynamic类型被忽略
  • 解决办法:
services.AddMvc().AddJsonOptions(opt =>
{
    opt.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver();
});
// .net core 3.0以上
// Microsoft.AspNetCore.Mvc.NewtonsoftJson
.AddNewtonsoftJson(opt =>
{
    opt.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver();
});

vs2019出提示:缺少配置和管理IIS Express所需的组件

未能正确加载“Visual Web Developer Project Persistence Package”包。

  • 解决:修复vs2019.

使用mvc报错

Endpoint Routing does not support 'IApplicationBuilder.UseMvc(...)'. To use 'IApplicationBuilder.UseMvc' set 'MvcOptions.EnableEndpointRouting = false' inside 'ConfigureServices(...).”
解决方法:

services.AddMvc(options => { options.EnableEndpointRouting = false; });
上一篇:【架构师面试-Java编程基本功-9】-Linux基本命令


下一篇:Nexus迁移记录