app-config

How to specify path in .config file relative to the file?

倖福魔咒の 提交于 2020-02-20 07:12:39
问题 An app I use interprets a .NET .config file. I added a line specifying the path to a certificate it needs <add key="Certificate" value="..\certificate.abc"/> However, I found the app only works when run from the exact folder its .exe and .config reside. If run from another folder, it fails, because it looks for the certificate at ../ expanded relative to the working directory . What should I write in the config file, to make sure the path is ..\certificate.abc expanded relative to the config

Nuget Config.Transform Formatting Issue

左心房为你撑大大i 提交于 2020-01-23 08:41:05
问题 I have created a Nuget config transform file that has the following transformation: <?xml version="1.0"> <configuration> <system.serviceModel> <bindings> <netTcpBinding> <binding name="NetTcpBinding_IMyService" /> </netTcpBinding> </bindings> <client> <endpoint address="net.tcp://mydomain/MySvc/MySvc.svc" binding="netTcpBinding" bindingConfiguration="NetTcpBinding_IMyService" contract="MyNamespace.MyService" name="NetTcpBinding_IMyService"> <identity> <userPrincipalName value="admin@mydomain

Can't read app.config in C# .NET Core unit test project with ConfigurationManager

China☆狼群 提交于 2020-01-22 13:10:50
问题 I've created a simple unit test project to read an app.config file. Target framework is Core 2.0. I also created a Core 2.0 console app, to sanity-check myself to make sure I wasn't doing anything weird (same test passed as expected in a .NET 4.6.1 unit test project). The console app reads the app.config fine, but the unit test method fails and I cannot figure out why. Both are using a copy of the same app.config (not added as a link) and both have the System.Configuration

How can I introduce a config file to Powershell scripts?

女生的网名这么多〃 提交于 2020-01-22 05:18:07
问题 Assume that I have a Powershell script called Foo.ps1 I would like to introduce an XML configuration file called Foo.ps1.config where I can specify my environment settings something like: <FunctionsDirectory> $ScriptDirectory\Functions </FunctionsDirectory> <ModulesDirectory> $ScriptDirectory\Modules </ModulesDirectory> And then I would like to load this configuration in the begining of Foo.ps1 so that I can import my modules and dot notate to the Functions directory. How can I achieve this

Modifying app.config at runtime throws exception

别说谁变了你拦得住时间么 提交于 2020-01-16 18:11:28
问题 I'm using app.config file to store and read some parameters (sql server instance name, user, password, log directory, etc). Now, I need to modify some parameters which depends of user and managed this but only if I run .exe from bin/release directory. When I create setup and install my aplication I'm not able to change this parameters - it throws TargetInvocationException . I've tried to run my app as administrator but without success. The code which I currently use is the following: System

WCF Different authentication method for each endpoint

拟墨画扇 提交于 2020-01-16 07:17:07
问题 I have a WCF service. My service has 2 endpoints each of which has a different contact. The service uses custom user name authentication (defined in the customUserNamePasswordValidatorType attribute of under ) The problem is that both endpoins will use the same anthentication method. Is there anyway I can define different anthentication method for each endpoint? Each endpoint is accessed by a different and only one app. So if I can pass in the app name to the authentication method, what would

C# - Compiler Error: System.Configuration.ConfigurationErrorsException was unhandled

◇◆丶佛笑我妖孽 提交于 2020-01-16 03:28:41
问题 Hey Everyone, How do I fix the Compiler Error upon compiling on " return ((string)(this["TargetDir"])); ": System.Configuration.ConfigurationErrorsException was unhandled Configuration system failed to initialize {"Unrecognized configuration section userSettings/CCP.Settings1. (C:\\Users\\bmccarthy\\Documents\\Visual Studio 2008\\Projects\\CCP Utility\\CCP Utility\\bin\\Debug\\CCP_Utility.exe.config line 21)"} A first chance exception of type 'System.Configuration.ConfigurationErrorsException

Creating Custom Binding programmatically

那年仲夏 提交于 2020-01-15 10:12:30
问题 We need compression in our WCF Web Service and have already found a good solution: http://www.codeproject.com/Articles/53718/Extending-WCF-Part-II There's only one problem. Configuration files are no option. How those Custom Bindings can be created in code? <customBinding> <binding name="ZipBinding" closeTimeout="00:10:00" openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00"> <customMessageEncoding innerMessageEncoding="mtomMessageEncoding" messageEncoderType=

Creating Custom Binding programmatically

独自空忆成欢 提交于 2020-01-15 10:07:57
问题 We need compression in our WCF Web Service and have already found a good solution: http://www.codeproject.com/Articles/53718/Extending-WCF-Part-II There's only one problem. Configuration files are no option. How those Custom Bindings can be created in code? <customBinding> <binding name="ZipBinding" closeTimeout="00:10:00" openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00"> <customMessageEncoding innerMessageEncoding="mtomMessageEncoding" messageEncoderType=

Creating Custom Binding programmatically

坚强是说给别人听的谎言 提交于 2020-01-15 10:06:23
问题 We need compression in our WCF Web Service and have already found a good solution: http://www.codeproject.com/Articles/53718/Extending-WCF-Part-II There's only one problem. Configuration files are no option. How those Custom Bindings can be created in code? <customBinding> <binding name="ZipBinding" closeTimeout="00:10:00" openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00"> <customMessageEncoding innerMessageEncoding="mtomMessageEncoding" messageEncoderType=