Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alow bin\Web.config to override Web.config #4702

Closed
jez9999 opened this issue Oct 19, 2018 · 11 comments
Closed

Alow bin\Web.config to override Web.config #4702

jez9999 opened this issue Oct 19, 2018 · 11 comments
Labels
area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions feature-kestrel
Milestone

Comments

@jez9999
Copy link

jez9999 commented Oct 19, 2018

One major issue I continually have with ASP.NET is the inability to perform XDT transformations on my Web.config file when I debug. I want to hit F5 and get an XDT transformation that inserts config values appropriate for my debugging setup. It seems to me that a good way to do this would be for the web server to first search for bin\Web.config, which could be the output location for the base Web.config with XDT transformations applied (from a base Web.Debug.config file). If it finds that file, it uses it, otherwise it falls back to the base Web.config. Could this be implemented? Then we could press F5, VS does the XDT transformation for our Web.Debug.config, writes it to the bin directory, and the web server uses that when we're debugging.

@muratg
Copy link
Contributor

muratg commented Oct 19, 2018

@vijayrkn should this be moved to websdk repo?

@RudeySH
Copy link

RudeySH commented Oct 19, 2018

Seconding this. SlowCheetah, which provides transformations during debug for App.config files, has proven to be immensely popular. Web applications should get this functionality too, one way or another.

One thing though, you mention XSLT but I think you mean XDT. Ah, I see you've edited it.

@vijayrkn
Copy link

vijayrkn commented Oct 19, 2018

+@BillHiebert

@muratg - This will have to go to the developer community since this is a VS feature request for F5 experience.

@jez9999
Copy link
Author

jez9999 commented Oct 19, 2018

@vijayrkn What if it were just implemented in the web server, though? It needn't be baked in to Visual Studio because an extension like SlowCheetah could do the transform and output it to the bin directory; the main problem is the web server not looking for bin\Web.config and using that instead of the base Web.config.

@Tratcher
Copy link
Member

Tratcher commented Oct 19, 2018

Note only IIS reads the Web.Config, not ASP.NET Core. That makes this a Windows feature request. @shirhatti

@jez9999
Copy link
Author

jez9999 commented Oct 20, 2018

@Tratcher Is it recommended that a different mechanism be used for configuring a web app in ASP.NET core, then?

@davidfowl
Copy link
Member

@jez9999 ASP.NET Core is mostly code based configuration. There are some things you can set in configuration (like logger settings) but there's no transform step. It would be good to understand what problems you are trying to solve here.

@jez9999
Copy link
Author

jez9999 commented Oct 20, 2018

@davidfowl Things like transforming connection strings, passwords, IP addresses, etc. for the local developer machine setup. I am used to using config transforms for this for example when you publish your web application to a live or staging server.

@davidfowl
Copy link
Member

OK I see, you just want to provide general configuration. ASP.NET Core's templates have appsettings.{Environment}.json configuration files. See https://docs.microsoft.com/en-us/aspnet/core/fundamentals/environments?view=aspnetcore-2.1 for more details on environments in general.

This really has nothing to do with the webserver but instead is just a deployment gesture (also storing settings in configuration is bad because you don't want secrets in source control).

See this doc for the recommended flow for secrets in production and development https://docs.microsoft.com/en-us/aspnet/core/security/app-secrets?view=aspnetcore-2.1&tabs=macos

@jez9999
Copy link
Author

jez9999 commented Oct 20, 2018

What I do is exclude my debugging settings files from source control and use transforms to insert the secrets for production ones, so I'm not actually storing secrets in source control.

@aspnet-hello aspnet-hello transferred this issue from aspnet/KestrelHttpServer Dec 13, 2018
@aspnet-hello aspnet-hello added this to the Discussions milestone Dec 13, 2018
@aspnet-hello
Copy link

We periodically close 'discussion' issues that have not been updated in a long period of time.

We apologize if this causes any inconvenience. We ask that if you are still encountering an issue, please log a new issue with updated information and we will investigate.

@dotnet dotnet locked and limited conversation to collaborators Mar 11, 2019
@amcasey amcasey added area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions and removed area-runtime labels Jun 2, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions feature-kestrel
Projects
None yet
Development

No branches or pull requests

8 participants