简体   繁体   English

为什么我的 web.config 在我发布时被覆盖?

[英]Why is my web.config being overwritten when I publish?

I'm using an ASP.NET Core 3.1 MVC website project.我正在使用 ASP.NET Core 3.1 MVC 网站项目。

web.config set the property Copy to Output Directory set to Do not copy . web.config设置属性Copy to Output Directory设置为Do not copy

Yet when I publish the ASPNETCORE_ENVIRONMENT is changed from Production to Development - why?然而,当我发布ASPNETCORE_ENVIRONMENTProduction更改为Development时 - 为什么?

Thanks in advance.提前致谢。

ASPNETCORE_ENVIRONMENT is an environment variable, and it's set by your publish profile. ASPNETCORE_ENVIRONMENT 是一个环境变量,它由您的发布配置文件设置。

Environment variables in Core 3.1 Core 3.1 中的环境变量

See: For Windows IIS deployments: Include the property in the publish profile (.pubxml) or project file.请参阅:对于 Windows IIS 部署:在发布配置文件 (.pubxml) 或项目文件中包含该属性。 This approach sets the environment in web.config when the project is published此方法在项目发布时在 web.config 中设置环境

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 为什么我在我的web.config中得到了这个 - why I got this in my web.config 我唯一的连接字符串是LocalSqlServer-运行测试时为什么不加载Web.config? - My only connection string is LocalSqlServer - Why is Web.config not loading when I run a test? 为什么使用WebConfigurationManager在Web.Config中找不到AppSetting? - Why can I not find an AppSetting in my Web.Config with WebConfigurationManager? 使用自定义部分时,为什么必须在我的app.config中指定程序集而不是为web.config指定程序集 - Why do I have to specify the assembly in my app.config but not for my web.config when using custom sections 根据发布配置文件发布之前,如何验证我的web.config? - How can I validate my web.config before I publish according to the publishing profile? 为什么我不能在我的 Web ASP 应用程序中打开自定义 web.config 文件? - Why can't I open a custom web.config file in my web ASP app? Web.Config不发布某些文件 - Web.Config to not publish certain files 为什么我的 404 重定向在我的 web.config 中不起作用? - Why does my 404 redirect not work in my web.config? web.config转换未应用于发布或构建安装包 - web.config transforms not being applied on either publish or build installation package 为什么我无法运行MVC5应用,web.config文件出现错误? - Why i cannot run my MVC5 app, error from web.config file?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM