app-config

developer specific app.config/web.config files in Visual Studio

萝らか妹 提交于 2019-11-30 06:13:22
问题 We have several .NET projects where we store certain settings in config files. Now each developer will have their own config files that differ a little (different connection strings to connect to local db, different WCF endpoints etc.) At the moment we tend to check out app/web.config files and modify them to suit our needs. This leads to many problems since from time to time someone will check in their own settings or loose custom config when getting latest version from tfs. My question is:

How do I retrieve AppSettings from the assembly config file?

a 夏天 提交于 2019-11-30 05:56:36
问题 I would like to retrieve the AppSetting key from the assembly config file called: MyAssembly.dll.config. Here's a sample of the config file: <configuration> <appSettings> <add key="MyKey" value="MyVal"/> </appSettings> </configuration> Here's the code to retrieve it: var myKey = ConfigurationManager.AppSettings["MyKey"]; 回答1: Using the OpenMappedExeConfiguration gives you back a "Configuration" object which you can use to peek into the class library's config (and the settings that exist there

Using Windows Role authentication in the App.config with WCF

走远了吗. 提交于 2019-11-30 05:20:14
I am using a WCF service and a net.tcp endpoint with serviceAuthentication's principal PermissionMode set to UseWindowsGroups. Currently in the implementation of the service i am using the PrincipalPermission attribute to set the role requirements for each method. [PrincipalPermission(SecurityAction.Demand, Role = "Administrators")] [OperationBehavior(Impersonation = ImpersonationOption.Required)] public string method1() I am trying to do pretty much the same exact thing, except have the configuration for the role set in the app.config. Is there any way to do this and still be using windows

If app.config for a DLL should be in the “main config”… what do we do with WCF References in DLLs?

吃可爱长大的小学妹 提交于 2019-11-30 05:15:29
Ok, this is rather simple, but from what I've seen… you can only use some sort of Windows Workflow to include another config into another (which I refuse to do). Here's the deal: MAINAPP.EXE References an hypothetical LIBRARY.DLL. MAINAPP.EXE has its own MAINAPP.EXE.config. If you add "config values" to LIBRARY.DLL (thereby creating an app.config in LIBRARY.DLL project), those values are not available at runtime even if you copy app.config into LIBRARY.DLL.config to the right path post-build . The reason for the above is that even referenced libraries will read from the "mainapp.exe" config.

Multiple applications with different names for the same code base

谁都会走 提交于 2019-11-30 04:24:30
Reading this article, thought having the same problem - One code base, two applications on Android I have created an application testApp that has items like topics , splash screens , logos , charts , rules , statuses and/or events . Now, I want different applications ( testApp_USA , testApp_Canada , testApp_Australia )from the same code base and put them on Google Play Store so that if user downloads the application, say, testApp_USA , then only the specific items to that region should be shown like splash Screen of USA, USA logos, etc.. So I want to configure multiple applications according

Get dynamic property from Settings

老子叫甜甜 提交于 2019-11-30 03:12:04
问题 I've got a few properties stored in my AppConfig and now I want to access them dynamically (e.g. in a loop or function). Accessing the values using MySettings.NAME_OF_THAT_THING is no problem, but what if the name is variable? I tried: String propertyValue = MySettings.GetType().GetProperty("NAME_OF_THAT_THING").ToString(); But the only thing I got back is the name of the property. How can I do this? 回答1: String propertyValue = MySettings.GetType() .GetProperty("NAME_OF_THAT_THING") .GetValue

How to edit application configuration settings? App.config best way to go?

前提是你 提交于 2019-11-30 02:34:04
问题 For my project I have settings that I added through the Settings in the project properties. I quickly discovered that editing the app.config file directly seems to no really update the settings value. Seems I have to view the project properties when I make a change and then recompile. I'm wondering ... what is the best and easiest way to handle customizable settings for a project -- thought this would be a no-brainer with how .Net handles it ... shame on me. Is it possible to use one of the

Can several WCF services share a common BaseAddress?

こ雲淡風輕ζ 提交于 2019-11-30 02:12:55
I've got an assembly containing several WCF services, each with its own contract. It all works nicely. The service config in the app.config for the service looks like this: <services> <service behaviorConfiguration="WcfService.AlyzaServiceBehavior" name="Sam.Alyza.WcfService.ServiceWebsites"> <endpoint address="" binding="netTcpBinding" contract="Sam.Alyza.WcfInterface.IServiceWebsites"> <identity> <dns value="localhost" /> </identity> </endpoint> <endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange" /> <host> <baseAddresses> <add baseAddress="net.tcp://localhost:8731

.NET - deploying a WCF client, without an app.config

倾然丶 夕夏残阳落幕 提交于 2019-11-30 01:43:02
I'm writing a client to a WCF service. This is a single app in a larger system that includes modules written in C#, C++, VB, and Java. All of the apps share common configuration and logging mechanisms, regardless of what language they were written in. I'd like to figure out how to build the client application so that it will run without an app.config. Why? Because most of what is in the app.config is boilerplate that the sysadmins shouldn't be allowed to change, and what settings the sysadmins should be allowed to change should be in the system-wide configuration, and not in an app.config file

C# how to specify the appData file path in the app.config file

旧城冷巷雨未停 提交于 2019-11-30 01:20:43
问题 I am using log4net and I was to save the log file in the AppData file for win XP/Vista etc. This is my app.config file so far, and I have specified the name softphone.log. Hoewver, I am not sure how to specify the complete path to the file as each user will have a different path depending on their username. <log4net> <logger name="default"> <level value="DEBUG"/> </logger> <appender name="RollingFileAppender" type="log4net.Appender.RollingFileAppender"> <file value="softphone.log"/>