appsettings

Can I set listen URLs in appsettings.json in ASP.net Core 2.0 Preview?

送分小仙女□ 提交于 2019-11-29 02:52:18
问题 I'm creating an ASP.net Core 2.0 app to run on the .net Core 2.0 runtime, both currently in their Preview versions. However, I cannot figure out how to have Kestrel use something other than the default http://localhost:5000 listen URL. Most documentation that I could Google talks about a server.urls setting, which seems to have been changed even in 1.0-preview to just be urls , however neither works (turning on Debug logging has Kestrel telling me that no listen endpoints are configured). A

Can someone provide a quick App.config/Web.config tutorial?

假装没事ソ 提交于 2019-11-28 23:58:56
I've used these two configuration files many times before, but I've never taken the time to fully understand how they really work. As most people do, I understand the basics in how to call WebConfigurationManager.AppSettings["key"] to get config values. Here are some questions I came up with: What happens when you reference a configuration value within a class library, and the library is part of a bigger solution? Does the app.config need to be copied to the output directory in order for the variables to be found? (I assume yes) Can you directly use a configuration value from an app.config in

Get the App.Config of another Exe

两盒软妹~` 提交于 2019-11-28 23:02:04
I have an exe with an App.Config file. Now I want to create a wrapper dll around the exe in order to consume some of the functionalities. The question is how can I access the app.config property in the exe from the wrapper dll? Maybe I should be a little bit more in my questions, I have the following app.config content with the exe: <?xml version="1.0" encoding="utf-8" ?> <configuration> <appSettings> <add key="myKey" value="myValue"/> </appSettings> </configuration> The question is how to how to get "myValue" out from the wrapper dll? thanks for your solution. Actually my initial concept was

Best practices for storing UI settings?

淺唱寂寞╮ 提交于 2019-11-28 18:57:07
we're currently planning a larger WPF LoB application and i wonder what others think being the best practice for storing lots of UI settings e.g. Expander States Menu orders Sizing Properties etc... i don't like the idea of having dozens of stored values using the delivered SettingsProvider (i.e. App.config file) although it can be used to store it in an embedded database using a custom SettingsProvider. being able to use some kind of databinding is also a concern. Has anyone had the same problems? What did you do to store lots of ui user settings? We store the preferences file here:

Different application settings depending on configuration mode

不羁的心 提交于 2019-11-28 18:53:00
Is anyone aware of a way that I can set application (or user) level settings in a .Net application that are conditional on the applications current development mode? IE: Debug/Release To be more specific, I have a url reference to my webservices held in my application settings. During release mode I would like those settings to point to http://myWebservice.MyURL.com during debug mode I would love those settings to be http://myDebuggableWebService.MyURL.com . Any ideas? I know this was asked years ago, but just in case anyone is looking for a simple and effective solution that I use. Go to

how to get value from appsettings.json

我是研究僧i 提交于 2019-11-28 16:41:23
public class Bar { public static readonly string Foo = ConfigurationManager.AppSettings["Foo"]; } In the .NET Framework 4.x, I can use the ConfigurationManager.AppSettings ["Foo"] to get Foo in Webconfig ,and then I can easily get the value of Foo through Bar.Foo But in .Net core, I mustto inject options , And can not get the value of Foo through Bar.Foo Is there a method, which can be directly through the Bar.Foo to get the value of Foo ? So there are really two ways to go about this. Option 1 : Options Class You have an appsettings.json file : { "myConfiguration": { "myProperty": true } }

AppSettings.json for Integration Test in ASP.NET Core

旧街凉风 提交于 2019-11-28 10:48:57
I am following this guide . I have a Startup in the API project that uses an appsettings.json configuration file. public class Startup { public Startup(IHostingEnvironment env) { var builder = new ConfigurationBuilder() .SetBasePath(env.ContentRootPath) .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true) .AddEnvironmentVariables(); Configuration = builder.Build(); Log.Logger = new LoggerConfiguration() .Enrich.FromLogContext() .ReadFrom.Configuration(Configuration) .CreateLogger(); } The particular part I'm looking at is the env.ContentRootPath . I did some digging around

How do I supply extra info to IApplicationSettingsProvider class?

最后都变了- 提交于 2019-11-28 09:36:22
问题 Perhaps this question has been asked before in a different way, but I haven’t been able to find it. I have one or more plugin adapter assemblies in my application all having the type IPlugin, for instance. Each adapter has its own settings structures stored in a common directory. Whether they are stored in one contiguous file or in separate ones doesn’t matter. Each adapter can have one or more settings associated with it. The settings will have both a name and the Plugin it will be used for.

How to use ConfigurationManager.AppSettings with a custom section?

♀尐吖头ヾ 提交于 2019-11-28 03:15:01
问题 I need to get "http://example.com" from using App.config file. But at the moment I am using: string peopleXMLPath = ConfigurationManager.AppSettings["server"]; I cannot get the value. Could you point out what I am doing wrong? <?xml version="1.0" encoding="UTF-8"?> <configuration> <configSections> <section name="device" type="System.Configuration.SingleTagSectionHandler" /> <section name="server" type="System.Configuration.SingleTagSectionHandler" /> </configSections> <device id="1"

Read appsettings json values in .NET Core Test Project

岁酱吖の 提交于 2019-11-27 22:00:02
问题 My Web application needs to read the Document DB keys from appsettings.json file. I have created a class with the key names and reading the Config section in ConfigureaServices() as: public Startup(IHostingEnvironment env) { var builder = new ConfigurationBuilder() .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true) .AddEnvironmentVariables(); Configuration = builder.Build(); } public IConfigurationRoot Configuration { get; } public void ConfigureServices(IServiceCollection