23

When publishing a .Net Core app to a server via WebDeploy, a Web.Config file is created, with stdoutLogEnabled=false. This is overwriting the web.config on the server where I have set stdoutLogEnabled=true.

I struggling to find how I set the default value of stdoutLogEnabled prior to publishing. On .Net framework apps I would do this within the web.config file with transformations, however in .Net core I actually don't have a web.config file within my solution.

I've tried to find documentation on how to set the value, but it either doesn't exist, or more likely, I'm not using the correct search term. Can somebody please advise on how to set default values in the web.config.

spottedmahn
  • 14,823
  • 13
  • 108
  • 178
Dave0504
  • 1,057
  • 11
  • 30

1 Answers1

28

Create a web.config and put it the root directory of your source, Modify the web.config file to enable logging and any other customization you need.

When you publish, it’ll use that file instead of generating a completely new file.

Edward
  • 28,296
  • 11
  • 76
  • 121
Kyle Dodge
  • 834
  • 7
  • 17
  • 2
    When I created a web.config, my .csproj automatically set this file to "remove" and not to publish to output directory. After changing that, this worked perfectly for me! – neilsimp1 May 07 '19 at 13:29
  • 1
    Does this overwrite the entire file? What if I want all other defaults? – Switch386 May 09 '19 at 21:05
  • 1
    @Switch386 Then copy the default one into a custom web.config and add anything else you need. – Ryan Wilson Sep 24 '19 at 16:03