ThinkBinaryStylish Jekyll Theme
https://www.thinkbinary.co.uk/
Setting up SDKMAN! with Fish and Homebrew<p>Assuming you are a macOS user, managing your installed software with <a href="https://brew.sh/">HomeBrew</a> and using <a href="https://fishshell.com/">Fish</a> as your shell of choice, these are the steps to allow you to use <a href="https://sdkman.io/">SDKMAN</a> to manage your Java sdks for your projects</p>
<h2 id="install-sdkman-with-homebrew">Install SDKMAN with Homebrew</h2>
<p><a href="https://sdkman.io/">SDKMAN</a> has it’s own <a href="https://github.com/sdkman/homebrew-tap">HomeBrew Tap</a> which you can use to install the software.</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>brew tap SDKMAN/tap
brew <span class="nb">install </span>SDKMAN-cli
</code></pre></div></div>
<p>This will add the SDKMAN tap to your Homebrew configuration and then use it to install the SDKMAN CLI.</p>
<h2 id="install-fisher">Install Fisher</h2>
<p>If you do not already have it installed, you will need to install <a href="https://github.com/jorgebucaran/fisher">Fisher</a>, this is a plug-in manager for the <a href="https://fishshell.com/">Fish shell</a>.</p>
<p>Full installation instructions are available in the <a href="https://github.com/jorgebucaran/fisher#readme">Readme on the Fisher project</a>, but the crux of the installation is:</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>curl <span class="nt">-sL</span> https://raw.githubusercontent.com/jorgebucaran/fisher/main/functions/fisher.fish | <span class="nb">source</span> <span class="o">&&</span> fisher <span class="nb">install </span>jorgebucaran/fisher
</code></pre></div></div>
<h2 id="install-sdkman-for-fish-extension">Install SDKMAN for Fish extension</h2>
<p>You will need to install the <a href="https://github.com/reitzig/sdkman-for-fish">SDKMAN! for Fish extension</a>.
This extension makes command <code class="language-plaintext highlighter-rouge">sdk</code> from <a href="https://sdkman.io/">SDKMAN!</a> usable from fish, including auto-completion. Also adds binaries from installed SDKs to the PATH.</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>fisher <span class="nb">install </span>reitzig/[email protected]
</code></pre></div></div>
<h2 id="configure-it-all">Configure it all</h2>
<p>At this point all the moving parts are installed, but some configuration still needs to be done to tie it all together.</p>
<p>Find out where SDKMAN! has been installed</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">echo</span> <span class="si">$(</span>brew <span class="nt">--prefix</span> SDKMAN-cli<span class="si">)</span>/libexec
</code></pre></div></div>
<p>In my case, this told me that SDKMAN was installed to <code class="language-plaintext highlighter-rouge">/opt/homebrew/opt/SDKMAN-cli/libexec</code>
Keep a note of the result of that command as you will need it later.</p>
<p>You will need to configure the SDKMAN for Fish plugin to use SDKMAN from the custom location that Homebrew installed it into.</p>
<p>Create a configuration file for the SDKMAN plugin for fish.</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">touch</span> ~/.config/fish/conf.d/config_sdk.fish
</code></pre></div></div>
<p>In that file, add the following command to tell the plugin where it can find SDKMAN</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">set</span> <span class="nt">-g</span> __sdkman_custom_dir /opt/homebrew/opt/sdkman-cli/libexec
</code></pre></div></div>
<p>You should now have SDKMAN working and set up in the Fish shell.</p>
<p>Fire up a new shell so that you have a fresh instance of Fish with all of it’s plug-ins set up, and use the following command to see if SDKMAN is now working</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>sdk <span class="nb">help</span>
</code></pre></div></div>
Sun, 07 Jan 2024 10:00:00 +0000
https://www.thinkbinary.co.uk/2024/01/07/setting-up-sdkman-with-fish-and-homebrew
https://www.thinkbinary.co.uk/2024/01/07/setting-up-sdkman-with-fish-and-homebrewChange the type of an AWS Parameter Store value<p>AWS Parameter Store is a great resource for storing configuation information for your applications.
It can store plain text settings as a String, as well as confidential information like passwords and connection strings as SecureString.
SecureString is encrypted by AWS when it is stored.</p>
<p>When setting these up, some people can go overboard and make things secure that do not need to be secure.
Normally, this is not a problem, but it is a little more inconvenient than it needs to be.</p>
<p>The AWS Management Console does not offer a easy way to change the type of a parameter store value once it has been created.
To do this as a one off operation, it it possible to use powershell to help you out and very quickly replace the existing parameter with a new one with the same name, but a different type.</p>
<p>This approach is not perfect and there will be a small window of time where the parameter does not exist at all.</p>
<h2 id="install-aws-powershell-tools">Install AWS PowerShell tools</h2>
<p>Firstly, you will need to install the AWS PowerShell tools.
Documentation for how to <a href="https://docs.aws.amazon.com/powershell/latest/userguide/pstools-getting-set-up.html">install the PowerShell tools for Windows, macOS and Linux</a> ia available on the AWS Documentation website.</p>
<h2 id="approach">Approach</h2>
<p>Using PowerShell, we will be able to read the value of the existing secure string, delete the original value, and then create a new parameter with the same name in it’s place with the same value, but stored as a string.</p>
<script src="https://gist.github.com/codedemonuk/321a2f3631375cd5647111f6aff3bc3d.js"> </script>
Fri, 02 Apr 2021 18:00:00 +0000
https://www.thinkbinary.co.uk/2021/04/02/change-type-of-aws-parameter-store-values
https://www.thinkbinary.co.uk/2021/04/02/change-type-of-aws-parameter-store-valuesDownloading Videos from Public-i.tv<p>Local Government webcasting is dominated by Public-i.
According to their website, 85% of local government bodies that stream their meetings use Public-i to do so.
They provide a good service, but one of the limitations with them is that they don’t keep the videos online for too long.</p>
<p>If you want to watch an old video, you will need to make your own backup copy of it.
They have taken steps to ensure that it is possible to easily embed their videos onto other sites, and this work means that it is also easy to download the video itself for a given meeting.</p>
<!--more-->
<p>To do this, you will need to carry out a few steps.</p>
<ol>
<li>Download the source to the video page</li>
<li>Parse the source for the URI of the video file</li>
<li>Extract the title from the page</li>
<li>Download the video and rename the file</li>
</ol>
<p>This is all very easily achieved with a few lines of powershell and some regular expressions.</p>
<script src="https://gist.github.com/codedemonuk/eccc62be08581bf2683c0005cda09b2d.js"> </script>
Sun, 19 Nov 2017 23:00:00 +0000
https://www.thinkbinary.co.uk/2017/11/19/download-video-public-i
https://www.thinkbinary.co.uk/2017/11/19/download-video-public-iSetting up a Chef Server on Ubuntu<p>This tutorial will assume that you already have an LTS instance of Ubuntu Server running as a pysical machine or virtual machine.
Full <a href="https://www.ubuntu.com/download/server/install-ubuntu-server">instructions for installing Ubuntu Server</a> are available on the <a href="https://www.ubuntu.com/">Ubuntu website</a>.</p>
<h2 id="download-and-install-chef-server">Download and Install Chef Server</h2>
<p>From the <a href="https://downloads.chef.io/chef-server/">Chef Server Downloads</a> page, download the latest stable version of Chef for your operating system.
You can use either <a href="https://www.gnu.org/software/wget/">Wget</a> or <a href="https://curl.haxx.se/">Curl</a> for this.</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>wget https://packages.chef.io/files/stable/chef-server/12.14.0/ubuntu/16.04/chef-server-core_12.14.0-1_amd64.deb
</code></pre></div></div>
<p>Then use DPKG to install the package file into Ubuntu.</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">sudo </span>dpkg <span class="nt">-i</span> chef-server-core_12.14.0-1_amd64.deb
</code></pre></div></div>
<p>Once Chef has been installed, you can verify it by running the command <code class="language-plaintext highlighter-rouge">chef-server-ctl</code>.</p>
<h2 id="reconfiguring-chef">Reconfiguring Chef</h2>
<p>So far you have installed the basic commands for Chef, but you will not have a working Chef server yet.
To get that you will need to reconfigure chef with the following command:</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">sudo </span>chef-server-ctl reconfigure
</code></pre></div></div>
<p>This will take a number of minutes and set up Chef on your server, and will use Chef to install the various dependencies such as PostgreSql, RabbitMQ, etc.</p>
<p>At this point you can browse to the Chef server on port 80, but will see a page informating you that until you install the management console, there will not be much for you to see.</p>
<p><img src="/assets/img/looking-for-chef-server.png" alt="Empty Chef site" /></p>
<h2 id="set-up-your-admin-users-and-organisations">Set up your admin users and organisations</h2>
<p>You will now need to create a an administrative user with the Chef <code class="language-plaintext highlighter-rouge">user-create</code> command.
You will need to provide your username, forename, surname, email address, password and a location for it to store the generated certificate.</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">sudo </span>chef-server-ctl user-create pervezchoudhury Pervez Choudhury [email protected] p@ssw0rd <span class="nt">--filename</span> /home/pervezchoudhury/chef-certs/pervezchoudhury.pem
</code></pre></div></div>
<p>Next you will need to create an application and add your user to this new application.</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">sudo </span>chef-server-ctl org-create chefdemo <span class="s2">"Chef Demo"</span> <span class="nt">--association_user</span> pervezchoudhury <span class="nt">--filename</span> /home/pervezchoudhury/chef-certs/chefdemo.pem
</code></pre></div></div>
<h2 id="install-the-management-console">Install the management console</h2>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">sudo </span>chef-server-ctl <span class="nb">install </span>chef-manage
<span class="nb">sudo </span>chef-server-ctl reconfigure
<span class="nb">sudo </span>chef-manage-ctl reconfigure
</code></pre></div></div>
<p>You will now be able to log into the Chef manageent console using your username and password you created earlier.</p>
<h2 id="install-the-reporting-add-on">Install the reporting add-on</h2>
<p>Finally you will need to install the reporting add on to give you more information about your Chef infrastucture.</p>
<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">sudo </span>chef-server-ctl <span class="nb">install </span>opscode-reporting
<span class="nb">sudo </span>chef-manage-ctl reconfigure
<span class="nb">sudo </span>opscode-reporting-ctl reconfigure
</code></pre></div></div>
Sat, 22 Apr 2017 19:00:00 +0000
https://www.thinkbinary.co.uk/2017/04/22/setting-up-chef-server-on-ubuntu
https://www.thinkbinary.co.uk/2017/04/22/setting-up-chef-server-on-ubuntuSet up a Development ASP.Net web site in your local IIS<p>When developing an ASP.net application, it can be very useful to be able to
quickly set up the project in your local IIS server so you can build it and
start using it.</p>
<p>I have a couple of scripts that I like to drop into the root of my ASP.net
repositories which will quickly set up IIS for your project.</p>
<!--more-->
<p>These scripts depend upon the <a href="http://get-carbon.org/">Carbon PowerShell module</a> being available locally.</p>
<h2 id="install-website">Install Website</h2>
<p>This script will set up IIS, application pools, binding and local host file
entries for your website.</p>
<script src="https://gist.github.com/codedemonuk/f2e8a5b0a25f78c965ba24ff81646060.js"> </script>
<h2 id="uninstall-website">Uninstall Website</h2>
<p>This script will undo all of the good work carried out by the install script.</p>
<script src="https://gist.github.com/codedemonuk/29a2085855c82ffacb8dfd9dbe68e2b0.js"> </script>
Sat, 14 Jan 2017 15:50:00 +0000
https://www.thinkbinary.co.uk/2017/01/14/set-up-aspnet-web-site-in-local-iis
https://www.thinkbinary.co.uk/2017/01/14/set-up-aspnet-web-site-in-local-iisSet TeamCity's build number a todays date<p>When using TeamCity to run daily builds for things like unit test coverage,
duplicate code, security auditing, which can be time consuming running as part
of every commit, it is handy to be able to see which date they were run.</p>
<p>This can be easily achived by setting the TeamCity build number as the date
the build was started.</p>
<p>Add a Powershell build step to the build with the following code definition</p>
<script src="https://gist.github.com/codedemonuk/761bffc2d51b162ebc35.js"> </script>
Fri, 13 Jan 2017 17:00:00 +0000
https://www.thinkbinary.co.uk/2017/01/13/set-teamcity-build-number-as-todays-date
https://www.thinkbinary.co.uk/2017/01/13/set-teamcity-build-number-as-todays-dateEssential tools when setting up a new development environment<p>A list of essentials tools when setting up a new machine for software development.</p>
<!--more-->
<h2 id="terminals">Terminals</h2>
<ul>
<li>
<p><a href="https://conemu.github.io/en/">ConEmu</a><br />
<code class="language-plaintext highlighter-rouge">choco install conemu</code></p>
</li>
<li>
<p><a href="https://www.microsoft.com/en-us/download/details.aspx?id=50395">PowerShell 5</a><br />
<code class="language-plaintext highlighter-rouge">choco install powershell</code></p>
</li>
</ul>
<h2 id="ide">IDE</h2>
<ul>
<li>
<p><a href="">Visual Studio Community</a><br />
<code class="language-plaintext highlighter-rouge">choco install visualstudio2015community</code></p>
</li>
<li>
<p><a href="https://code.visualstudio.com/">Visual Studio Code</a><br />
<code class="language-plaintext highlighter-rouge">choco install visualstudiocode</code></p>
</li>
</ul>
<h2 id="ide-extensions">IDE Extensions</h2>
<h3 id="visual-studio">Visual Studio</h3>
<ul>
<li>Resharper</li>
<li>DotTrace</li>
<li>Web Essentials</li>
</ul>
<h3 id="visual-studo-code">Visual Studo Code</h3>
<ul>
<li>PowerShell</li>
<li>C#</li>
</ul>
<h2 id="languages">Languages</h2>
<ul>
<li>Node (via NVM)</li>
<li><a href="https://golang.org/">Go</a><br />
<code class="language-plaintext highlighter-rouge">choco install golang</code></li>
<li><a href="https://www.microsoft.com/net/core">.NET Core</a></li>
<li><a href="https://www.microsoft.com/net/download">.Net Framework 4.6.2</a><br />
<code class="language-plaintext highlighter-rouge">choco install dotnet4.6.2</code></li>
</ul>
<h2 id="net-development-tools">.NET development tools</h2>
<ul>
<li><a href="https://www.jetbrains.com/decompiler">DotPeek</a><br />
Decompile .NET assemblies to C# using JetBrains Resharper build in decompiler.<br />
<code class="language-plaintext highlighter-rouge">choco install dotpeek</code></li>
<li><a href="https://github.com/NuGetPackageExplorer/NuGetPackageExplorer">NuGet Package Explorer</a><br />
NuGet Package Explorer is a ClickOnce application which allows creating and exploring NuGet packages easily. After installing it, you can double click on a .nupkg file to view the package content. You can also load packages directly from the official NuGet feed.<br />
<code class="language-plaintext highlighter-rouge">choco install nugetpackageexplorer</code></li>
<li><a href="https://fxcopinstaller.codeplex.com/">FxCop</a><br />
FxCop is an application that analyzes managed code assemblies (code that targets the .NET Framework common language runtime) and reports information about the assemblies, such as possible design, localization, performance, and security improvements.<br />
<code class="language-plaintext highlighter-rouge">choco install fxcop</code></li>
</ul>
<h2 id="http-development">HTTP Development</h2>
<ul>
<li><a href="http://www.telerik.com/fiddler">Fiddler</a><br />
<code class="language-plaintext highlighter-rouge">choco install fiddler</code></li>
<li><a href="https://www.getpostman.com/">Postman</a><br />
<code class="language-plaintext highlighter-rouge">choco install postman</code></li>
</ul>
<h2 id="browsers">Browsers</h2>
<ul>
<li><a href="https://www.mozilla.org/en-GB/firefox/developer/">Firefox Developer Edition</a></li>
<li><a href="https://www.google.com/chrome">Chrome</a><br />
<code class="language-plaintext highlighter-rouge">choco install googlechrome</code></li>
</ul>
<h2 id="installers">Installers</h2>
<ul>
<li>Chocolatey <br />
<code class="language-plaintext highlighter-rouge">@powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"</code></li>
</ul>
<h2 id="source-control">Source Control</h2>
<ul>
<li>SourceTree<br />
<code class="language-plaintext highlighter-rouge">choco install sourcetree</code></li>
<li>TortoiseGit<br />
<code class="language-plaintext highlighter-rouge">choco install tortoisegit</code></li>
<li><a href="">PoSH Git</a><br />
<code class="language-plaintext highlighter-rouge">choco install poshgit</code></li>
<li><a href="https://git-scm.com/downloads">Git Command Line</a><br />
<code class="language-plaintext highlighter-rouge">choco install git</code></li>
<li>Git Credential Manager for Windows<br />
<code class="language-plaintext highlighter-rouge">choco install git-credential-manager-for-windows</code></li>
</ul>
<h2 id="merge">Merge</h2>
<ul>
<li><a href="http://kdiff3.sourceforge.net/">KDiff3</a><br />
Very good open source 3 way merge and diff tool.<br />
<code class="language-plaintext highlighter-rouge">choco install kdiff3</code></li>
</ul>
<h1 id="virtual-machines">Virtual Machines</h1>
<ul>
<li><a href="https://www.docker.com/">Docker</a><br />
An open platform for developers and sysadmins to build, ship, and run distributed applications.<br />
<code class="language-plaintext highlighter-rouge">choco install docker</code></li>
</ul>
<h2 id="data">Data</h2>
<ul>
<li><a href="https://www.linqpad.net">LinqPad</a><br />
<code class="language-plaintext highlighter-rouge">choco install linqpad</code></li>
<li><a href="https://github.com/MSOpenTech/redis">Redis for Windows</a><br />
<code class="language-plaintext highlighter-rouge">choco install redis-64</code></li>
<li><a href="https://msdn.microsoft.com/en-us/library/mt238290.aspx">SQL Server Management Studio</a><br />
<code class="language-plaintext highlighter-rouge">choco install mssqlservermanagementstudio2014express</code></li>
<li><a href="https://redisdesktop.com/">Redis Desktop Manager</a> <br />
A fast open source Redis database management application. <br />
<code class="language-plaintext highlighter-rouge">choco install redis-desktop-manager</code></li>
</ul>
<h2 id="misc">Misc</h2>
<ul>
<li><a href="https://www.baremetalsoft.com/baretail">Baretail</a><br />
A free real-time log file monitoring tool.<br />
<code class="language-plaintext highlighter-rouge">choco install baretail</code></li>
<li><a href="https://slack.com/is">Slack</a><br />
<code class="language-plaintext highlighter-rouge">choco install slack</code></li>
</ul>
Sun, 04 Sep 2016 18:50:00 +0000
https://www.thinkbinary.co.uk/2016/09/04/essential-tools-when-setting-up-new-development-environment
https://www.thinkbinary.co.uk/2016/09/04/essential-tools-when-setting-up-new-development-environmentBootstrapping Psake for your windows builds<p>Psake is a great build system for automating your .Net builds on Windows. To
save time when using it and to make it a simple command to run the build, I
like to place a batch file in the root of the code repository to allow you to
download and execute Psake without having to check in any binaries.</p>
<p>It also avoids the hassle of importing the Psake module and calling
<code class="language-plaintext highlighter-rouge">Invoke-Psake</code></p>
<!--more-->
<script src="https://gist.github.com/codedemonuk/db3c04190e24e9870898db4f4217c763.js"> </script>
Sun, 05 Jun 2016 15:05:00 +0000
https://www.thinkbinary.co.uk/2016/06/05/getting-started-with-psake
https://www.thinkbinary.co.uk/2016/06/05/getting-started-with-psakeAuto reconnecting Margiebot to Slack<p><a href="https://github.com/jammerware/margiebot">MargieBot</a> is a simple to use .Net framework for making your own bots for
Slack. To start up a bot and connect it to Slack, all it takes is:</p>
<figure class="highlight"><pre><code class="language-csharp" data-lang="csharp"><span class="n">Bot</span> <span class="n">myBot</span> <span class="p">=</span> <span class="k">new</span> <span class="nf">Bot</span><span class="p">();</span>
<span class="n">myBot</span><span class="p">.</span><span class="nf">Connect</span><span class="p">(</span><span class="s">"<your bot's slack API token>"</span><span class="p">);</span></code></pre></figure>
<p>This makes the happy path work very well, but out of the box this will not
handle dropped connections or attempting to reconnect to the server - so if the
connection is interrupted for any reason, you bot will no longer try to connect
to Slack.</p>
<!--more-->
<p>Fortunately MargieBot offers an extensibility point that we can use to add this
functionality in.</p>
<p>MargieBot emits a <code class="language-plaintext highlighter-rouge">ConnectionStatusChanged</code> event when the bot connects or
disconnects from Slack. it also exposes a public property called <code class="language-plaintext highlighter-rouge">IsConnected</code>.</p>
<p>We can wire up an event handler to the <code class="language-plaintext highlighter-rouge">ConnectionStatusChanged</code> event like so:</p>
<figure class="highlight"><pre><code class="language-csharp" data-lang="csharp"><span class="n">_bot</span> <span class="p">=</span> <span class="k">new</span> <span class="nf">Bot</span><span class="p">();</span>
<span class="n">_bot</span><span class="p">.</span><span class="n">ConnectionStatusChanged</span> <span class="p">+=</span> <span class="n">ConnectToSlackIfDisconnected</span><span class="p">;</span></code></pre></figure>
<p>Our event handler can then try to establish a connection to Slack and retry
until it is able to do so.</p>
<script src="https://gist.github.com/codedemonuk/2bc8d60fc2ea370a75ccb4abbba5578e.js"> </script>
<p>We can also re-ue this code when making the initial connection to Slack. Instead
of calling</p>
<figure class="highlight"><pre><code class="language-csharp" data-lang="csharp"><span class="n">_bot</span><span class="p">.</span><span class="nf">Connect</span><span class="p">(</span><span class="s">"<Slack API Token>"</span><span class="p">)</span> <span class="c1">// do not do this anymore</span></code></pre></figure>
<p>you can call the event handler explicitly with:</p>
<figure class="highlight"><pre><code class="language-csharp" data-lang="csharp"><span class="nf">ConnectToSlackIfDisconnected</span><span class="p">(</span><span class="k">false</span><span class="p">);</span> <span class="c1">// do this instead!</span></code></pre></figure>
Sun, 05 Jun 2016 12:30:00 +0000
https://www.thinkbinary.co.uk/2016/06/05/reconnect-margiebot-to-slack
https://www.thinkbinary.co.uk/2016/06/05/reconnect-margiebot-to-slackCastle Windsor ASP.Net HTTP Handler Factory<p>When writing a simple HTTP handler in .Net, the framework provides support for
replacing the default HTTP Handler Factory with your own factory which provides
support for dependency injection.</p>
<!--more-->
<p>The framework exposes an interface called <code class="language-plaintext highlighter-rouge">IHttpHandlerFactory</code> which you will
need to implement with the code for your custom factory.</p>
<h2 id="the-http-handler-factory">The HTTP Handler Factory</h2>
<p>Here’s one I prepared earlier that will return HTTP handlers based on the name
the classed were registered with in Castle Windsor.</p>
<script src="https://gist.github.com/codedemonuk/46cfbaa079e10ed14d69c684eab10c2e.js"> </script>
<p>It makes the assumption that your <code class="language-plaintext highlighter-rouge">HttpApplication</code> class in <code class="language-plaintext highlighter-rouge">Global.asax.cs</code>
exposes the container, via the IContainerAccessor interface.</p>
<h2 id="wiring-it-in">Wiring it in</h2>
<p>You will need to add an entry in your <code class="language-plaintext highlighter-rouge">web.config</code> file that tells the framework
to use your factory to satisfy HTTP requests.</p>
<figure class="highlight"><pre><code class="language-xml" data-lang="xml"><span class="nt"><configuration></span>
<span class="nt"><system.webServer></span>
<span class="nt"><handlers></span>
<span class="nt"><add</span>
<span class="na">verb=</span><span class="s">"GET,POST"</span>
<span class="na">path=</span><span class="s">"*.sample"</span>
<span class="na">name=</span><span class="s">"HandlerFactory"</span>
<span class="na">type=</span><span class="s">"CastleWindsorHttpHandlerFactory"</span><span class="nt">/></span>
<span class="nt"></handlers></span>
<span class="nt"></system.webServer></span>
<span class="nt"></configuration></span></code></pre></figure>
<p>This will register the extension .sample to have it’s requests satisfied by the
class that Castle Windsor believes is appropriate to handle that request
based on the logic in your handler factory.</p>
<p>More details for how to do this can be found on the <a href="https://msdn.microsoft.com/en-us/library/aa720140(v=vs.71).aspx">MSDN article on creating
and registering HTTP handler factories</a></p>
Sat, 26 Mar 2016 15:30:00 +0000
https://www.thinkbinary.co.uk/2016/03/26/windsor-http-handler-factory
https://www.thinkbinary.co.uk/2016/03/26/windsor-http-handler-factory