app-config

How to add Application name to <appSettings/>?

↘锁芯ラ 提交于 2019-12-02 06:48:31
问题 This is my app.config file looks like: <?xml version="1.0" encoding="utf-8" ?> <configuration> <appSettings> <add key="Application Name" value="/MyApplication" /> </appSettings> <connectionStrings> <add name="frmStartup.My.MySettings.HDIMembershipProviderConnectionString" connectionString="Data Source=.\sqlexpress;Initial Catalog=HDIMembershipProvider;Integrated Security=True" providerName="System.Data.SqlClient" /> </connectionStrings> <system.web> <membership defaultProvider=

Is there a way to set the local time, which may be different than the server's time, in an ASP.NET MVC3 application?

二次信任 提交于 2019-12-02 05:54:31
I have an MVC3 application the displays the current time locally, but displays the servers time when uploaded to hosting. Is there any way in the app.config or the web.config that I can set my local time to display once my app is uploaded to the server? UPDATE:I'm looking for a way to do this globally without going back and changing the code for every time I reference DateTime. It seems a little impractical to not be able to set the time for the application globally. set timezone information in the web.config and convert your time according to the web.config's timezone. DateTime timeUtc =

Custom Configuration Section can only be saved/modified while running as administrator?

我怕爱的太早我们不能终老 提交于 2019-12-02 04:20:27
I wrote a custom configuration section, collection, and element to add/modify to my app.config. All seems to be going well and it works perfectly running in Visual Studio. However, when I install the application and it comes time to save the new data to the custom config section, the following exception is thrown: System.Configuration.ConfigurationErrorsException: Unable to save config to file '{path to config file}' The interesting part is that if I run the application in administrator mode, everything works fine. Is there any reason it would only work as administrator? EDIT: I should note

List<T> overwrites all the items inside a foreach loop to the last value

大城市里の小女人 提交于 2019-12-02 03:24:09
I'm trying to build a windows application in which there is a combo box and during the Load(), I'm population this combo box with all the connection strings availabe in my app.Config file. Here is the app.Config snippet: <!-- Adding Multiple Servers in Connection String--> <connectionStrings> <add name="SQLConnect-1" connectionString="Data Source=SAHIL; Initial Catalog=RecordComparisonTool; Integrated Security=SSPI" providerName="System.Data.SqlCLient"/> <add name="SQLConnect-2" connectionString="Data Source=SAHIL; Initial Catalog=RecordComparisonTool; User Id=test; Password=12123; Integrated

How to add Application name to <appSettings/>?

自作多情 提交于 2019-12-02 02:54:45
This is my app.config file looks like: <?xml version="1.0" encoding="utf-8" ?> <configuration> <appSettings> <add key="Application Name" value="/MyApplication" /> </appSettings> <connectionStrings> <add name="frmStartup.My.MySettings.HDIMembershipProviderConnectionString" connectionString="Data Source=.\sqlexpress;Initial Catalog=HDIMembershipProvider;Integrated Security=True" providerName="System.Data.SqlClient" /> </connectionStrings> <system.web> <membership defaultProvider="HDIMembershipProvider"> <providers> <clear/> <add name="HDIMembershipProvider" type="MyApplication

SideBySide Error with Binding Redirect in .net Windows Service

末鹿安然 提交于 2019-12-02 00:36:05
I have a .net windows service which needs to load two different versions of an assembly. It runs on a server 2012 R2 box. I am using a binding redirect in separate .config file which is loaded into the main app.config using this before the closing </configuration> node ( see MSDN doc ): <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <linkedConfiguration href="file://E:\my-service\runtime.config" /> </assemblyBinding> My runtime.config contains the actual binding redirect: <configuration> <runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentAssembly>

reading web.config from class library

只愿长相守 提交于 2019-12-02 00:25:38
问题 i have two project 1) class library with no inteface just an api 2) web application from web apps i will be calling the class library api so i have all the web.config settings in the web application but when i debug it always return me null value and here is the code snippit: public static string readingDB { get { string result = null; result = ConfigurationManager.AppSettings["employeeDB"]; //conn string if (!string.IsNullOrEmpty(result)) { return result; } else { return ""; //???? THROW

reading web.config from class library

我只是一个虾纸丫 提交于 2019-12-01 21:19:35
i have two project 1) class library with no inteface just an api 2) web application from web apps i will be calling the class library api so i have all the web.config settings in the web application but when i debug it always return me null value and here is the code snippit: public static string readingDB { get { string result = null; result = ConfigurationManager.AppSettings["employeeDB"]; //conn string if (!string.IsNullOrEmpty(result)) { return result; } else { return ""; //???? THROW EXCEPTION??? } } } i have also tried, creating a new app.config in the class library project and have the

How do you find what debug switches are available? Or given a switch find out what is being disabled?

可紊 提交于 2019-12-01 21:16:40
问题 In this question the answer was to flip on a switch that is picked up by the debugger disabling the extraneous header that was causing the problem. The Microsoft help implies these switched are user generated and does not list any switches. <configuration> <system.diagnostics> <switches> <add name="Remote.Disable" value="1" /> </switches> </system.diagnostics> </configuration> What I would like to know is where the value "Remote.Disable" comes from and how find out what other things can be

Slowcheetah installed but there's no transform option

天大地大妈咪最大 提交于 2019-12-01 19:36:03
问题 I have a .NET 4.5 project with MVC 5 and EF 6, in Visual Studio 2013. I want to have transforms for app.config. I've installed the SlowCheetah project via NuGet, and (supposedly)[https://visualstudiogallery.msdn.microsoft.com/69023d00-a4f9-4a34-a6cd-7e854ba318b5] now I should be able to right-click on App.config and see the option Add Transform. But I don't. Does anyone know what are the possible reasons for this? I've checked that the package is installed in both projects in my solution,