且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

找不到文件异常Visual Studio 2015

更新时间:2022-03-11 19:44:47

我认为您忘记了使用Server.MapPath函数. 您可以使用以下代码编辑Constructor:

I think you forget to use Server.MapPath function. You can edit your Constructor with following code :

    public Startup()
    {
        var builder = new ConfigurationBuilder()
             .AddJsonFile(HttpContext.Current.Server.MapPath("~/config.json"));
        Configuration = builder.Build();
    }

希望它对您有帮助:)