Value cannot be null. Parameter name: connectionString appsettings.json in starter

前端 未结 14 1846
南旧
南旧 2020-12-16 10:07

I am trying to write my connection string in my appsettings.json file and bring it into my startup file but I keep getting a Value cannot be null. Parameter name: connection

14条回答
  •  醉梦人生
    2020-12-16 10:52

    in asp.net core you must add IConfiguration to startUp contractor method and assignee this Parameter to a property inherited from IConfiguration inside class

     public class Startup
    {
        public Startup(IConfiguration configuration)
        {
            this.Configuration = configuration;
        }
        public IConfiguration Configuration { get; }
    

提交回复
热议问题