简体   繁体   English

.Net Core Project中vs2017缺少web.config

[英]vs2017 missing web.config in .Net Core Project

I just noticed that whenever we create a new project, web.config file is not added to the project anymore. 我只是注意到,无论何时创建新项目,都不会再将web.config文件添加到该项目中。

According to this link , we can use appsettings.json as the replacement of web.config . 根据此链接 ,我们可以使用appsettings.json替代web.config And I am already using it to store some settings and using in my app. 而且我已经在使用它来存储一些设置并在我的应用程序中使用。

However, I don't know how to generate forwardWindowsAuthToken="true" in the web.config file while doing the publishing. 但是,我不知道在发布时如何在web.config文件中生成forwardWindowsAuthToken="true" We are using WindowsAuthentication for the website and it's not appended on the generated web.config file. 我们正在将WindowsAuthentication用于网站,并且未将其附加在生成的web.config文件中。

I tried to add that setting in the appsettings.json like the following and it's not still appending. 我尝试将设置添加到appsettings.json中,如下所示,但仍未附加。 I need to manually edit the web.config file on the webserver. 我需要在Web服务器上手动编辑web.config文件。

{
  "Logging": {
    "IncludeScopes": false,
    "LogLevel": {
      "Default": "Warning"
    }
  },
  "forwardWindowsAuthToken" :  true
}

It works when I added web.config file in my project and add forwardWindowsAuthToken="true" in the code. 当我在项目中添加web.config文件,并在代码中添加forwardWindowsAuthToken="true" ,它可以工作。

Since appsettings.json is replacing web.config file, I am not sure whether my approach is correct or not. 由于appsettings.json正在替换web.config文件,因此我不确定我的方法是否正确。 Am I doing right or is there a way to add that code in the generated web.config file automatically? 我做对了还是有办法自动在生成的web.config文件中添加该代码?

We have web.config with required configuration in VS2017 .NET Core project, and during publish dotnet would replace processPath and arguments attributes automatically. 我们在VS2017 .NET Core项目中具有必需配置的web.config ,在发布期间, dotnet将自动替换processPatharguments属性。 This did the trick in our deployment process. 这在我们的部署过程中起到了作用。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM