Configuration Management of .NET applications
I'm looking for some advice for a way to effeciently store configurations of our applications. A place where we could store i.e. connection strings that we could use in web.config files or maybe even a way to store whole config files.
Maybe there is some kind of key value store solution that could help with that, when during build or after deployment using TFS/Jenkins we can point there and grab connection string that should be used in web.config.
My main point is to get rid of environment specific connetion strings kept in build/relase steps or scripts that are used after deployment. Just one organized place to rull them all.
See also questions close to this topic
Get main Assembly name in referenced library which is injected into main Assembly
MySolution.MyLibraryclass library which I register in
MySolution.MyServiceWCF service using SimpleInjector:
I need to get the name of the main assembly,
MySolution.MyService, in the constructor of
MySolution.MyLibrary. I've tried Assembly.* methods but I couldn't manage to do it. Any ideas how I can get the name?
These are what I've tried:
Assembly.GetExecutingAssembly().GetName().FullName "MySolution.MyLibrary, Version=22.214.171.124, Culture=neutral, PublicKeyToken=null" Assembly.GetCallingAssembly().GetName().FullName "Anonymously Hosted DynamicMethods Assembly, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null" Assembly.GetEntryAssembly() null
How do you capture the output of a SQL Script run from .NET, including rows affected?
Consider this simple SQL script:
PRINT N'Dropping CREATE_TABLE events from DatabaseLog table...' DELETE FROM [dbo].[DatabaseLog] WHERE Event = N'CREATE_TABLE' PRINT N'Dropping ALTER_TABLE events from DatabaseLog table...' DELETE FROM [dbo].[DatabaseLog] WHERE Event = N'ALTER_TABLE' PRINT N'Done!'
When run from SSMS, against AdventureWorks 2012, it gives this output:
Dropping CREATE_TABLE events from DatabaseLog table... (70 row(s) affected) Dropping ALTER_TABLE events from DatabaseLog table... (117 row(s) affected) Done!
How do I reproduce this in .NET, including the rows affected lines?
By hooking into the
InfoMessageevent on the
SqlConnection, I get the output of the
Note: The script is user-supplied, so modifying the script to output the row counts manually is not an option.
Server side authentication in MQTT Server
I have tried to create MQTT Server using C#. Its work fine in my local environment.
- MQTT Server Code package : https://www.nuget.org/packages/System.Net.Mqtt.Server/
- MQTT Client Code : package https://www.nuget.org/packages/System.Net.Mqtt/
Its works fine.
I have modify my code with below argument.
client.ConnectAsync (new MqttClientCredentials (clientId, "UserName", "Password")).Wait ();
I had spent couple of hours to find solution - how to authentic client. But no luck. Please anyone guide me How can I authorize every client from server side using clientId, "UserName", "Password"
Waiting for suggestion.
Thanks In advance.
Store custom information within BuildDefintion object
I am using the TFS2018 api and I would like to store a template name as part of the BuildDefinition.cs object because I need to know what template the build definition is based on. Can I use the tag property for this or is there a recommended way to store custom information as part of the BuildDefinition?
Connect to TFs Server Remote
I Install Team Foundation Server in Remote Server And Create Git Repository on that,But I Can't Clone To this Repository in My computer Please Help me How to connect to this Repository.. Thank you...
TFS Installation error at Configure section of Application Tier Only Wizard
When doing Application Tier only installation on TFS, I received the following error at the Configure section of the Application Tier Only Wizard.
TF255356: The following error occurred when configuring the Team Foundation databases: TF246083: The configuration of Team Foundation Server is not valid. You must remap the databases in order to fix the configuration. The following error was received from the server: TF400673: Unable to find any compatible SQL Analysis Services database within the specified instance. '2' hosts have been given updated connection strings. .. For more information, see the configuration log.
How do I resolve this error?
<authorization> tag in web.config causing problems in debug mode
I have an ASP.net Visual Studio project and have the following in the web config:
<authorization> <allow roles = "Domain\UserGroup" /> <deny users="*" /> </authorization>
This means that only those users in "Domain\UserGroup" can access the page.
This works fine when the page is published to IIS, however when I am working on the project on my local Visual Studio and run the project using F5, I get
Server Error in '/' Application.
Access is denied.
Description: An error occurred while accessing the resources required to serve this request. The server may not be configured for access to the requested URL.
If I take the section out, it runs fine locally.
Is there any way round this other than commenting out the section in web config and reinstating it when it comes to publishing to IIS?
Web.config file gets malformed after clicking a save button
I have a webforms site, and I'm running it on Windows Server 2012 and IIS 8.5. There's a settings page, where if I click on the save button, several lines of xml get added to my web.config file:
<configProtectedData /> <system.diagnostics /> <system.windows.forms /> <System.Windows.Forms.ApplicationConfigurationSection /> <uri />
Which gives me this error on every page I visit, until I delete those lines
HTTP Error 500.19 - Internal Server Error The requested page cannot be accessed because the related configuration data for the page is invalid.
how does bindingRedirect in web.config file of ASP.NET determine oldVersion and newVersion?
When you install a Nuget Package, does it put the current version as the
newVersionand the previous versions as the
This is only checked at run time so if I were to install a newer version of the
dll, I would have to manually go and update the
bindingRedirect? According to this, I would assume so? But in a new asp.net webform project, it has Newtonsoft.json which has the Version of 126.96.36.199 in the properties but has
<bindingRedirect oldVersion="0.0.0.0-188.8.131.52" newVersion="184.108.40.206" />I do see that whatever Version is in the properties corresponds to the version in the
Also, why are only certain
dllin the runtime section? In my application only
System.Diagnostics.DiagnosticSourceare in this section. Why aren't other
dll's here? Are only
Systemgoing to be in the runtime section?
Switching in between a blue green environment
==========Assume the infra to be on AWS==========
I have a JAVA based microservice environment. Needless to explain them as they are very simple [Client<--->Server(Set of microservices)<--->Database]
I would like to know that if I switch in between one of the 2 environments in a Blue-Green scenario, how will I take care of pending transactions during the switching phase.
I need to preserve the transactions as well as route new transactions to the new environment.
Thanks in advance!! :)
Jenkins - identify if build is tagged
I have a Jenkins job that is hooked to bitbucket and starts with every commit. I want to make another job that listens to the same URL as the first job, but gets triggered only if the build is tagged.
The end flow should be : If build is tagged -> start 1st job. If build is not tagged -> start 2nd job.
Any ideas ? Thanks !
How to compile SASS .scss files in most basic method (without framework)
I installed Bootstrap CSS with SASS from the following repo:
I ran the command
"bower install bootstrap-sass"on the command line and this successfully installed the folder
bower_componentson my project folder. (Incidentally - I have nothing else present yet, I want to learn to bootstrap the CSS compiling first).
OK, here's what I want to accomplish:
- I want to be able to add
.scssfiles to the folder I create called
- I want to provision/manage so that
.scssfiles I add to this directory are in turn compiled to
- More practically, I would like to compile all of the .scss files into one large .css file.
My question(s) are:
- What does the compiling?
- How do I instruct it to compile the
.scssfiles in the folder above in the
- Must I configure new .scss files or can I set it so as to just add them to that sass folder?
- Bonus, how do I tell it to minify the output file, or not (so I can experiment with both ways)?
- I want to be able to add
Admin user Interface for spring-cloud-config?
We want to use spring-cloud-config for our Spring boot applications on Cloud Foundry. As default backend for fetching configuration a Git server seems to be the only option.
What I would need is some fancy web-based user interface to host my configuration properties, so that sombody not familiar with git could change properties. Going for some solution not already integrated with spring-cloud-config could also be an option, since the integration I could develop myself. But it needs to be open source.
Google did not help me, so maybe somebody here could provide some hints.
Is it possible to use patterns as branch type restrictions when creating a ClearCase trigger?
I'd like to create a branch restriction for a ClearCase preop merge trigger.
However, it should fire based not on the exact branch type, but rather based on whether the branch type follows a specific naming convention, like
Can I do this, or do I have to list every branch separately?
I read in "cleartool man mktrtype" that a "branch-type-selector" can be used, but unfortunately I was not able to find comprehensive information on what it entails, i.e. if it can be a version selector pattern as used in a config spec (using e.g. the three-dot ellipsis), or even a globbing pattern, or if it can only be an exact branch type name.
Is it possible to specify who is allowed to set a ClearCase attribute on a file?
Just what the title says: can I control what user is able to modify ClearCase attributes on a file-per-file basis based on some kind of permission system?
I am using Unix, but it also might be interesting to know if this is possible on Windows.