加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > asp.Net > 正文

asp.net-core – 为什么需要在ASP.NET Core MVC中设置“UseConte

发布时间:2020-12-16 06:34:24 所属栏目:asp.Net 来源:网络整理
导读:为什么需要在ASP.NET Core MVC中设置UseContentRoot(AppContext.BaseDirectory)? 解决方法 从 docs(在这种情况下我写的): Specifying Directory.GetCurrentDirectory as the content root will use the web project’s root folder as the app’s content
为什么需要在ASP.NET Core MVC中设置UseContentRoot(AppContext.BaseDirectory)?

解决方法

从 docs(在这种情况下我写的):

Specifying Directory.GetCurrentDirectory as the content root will use the web project’s root folder as the app’s content root when the app is started from this folder (for example,calling dotnet run from the web project folder). This is the default used in Visual Studio and dotnet new templates.

如果不添加此内容,则内容根目录将默认为应用程序根目录,即运行程序的位置(可能位于/ bin文件夹中的某个位置).如果您从源/项目根目录启动Web应用程序,通常不是您想要的.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读