<?xml version="1.0" encoding="iso-8859-1"?><!-- generator="b2evolution/4.0.3" -->
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:admin="http://webns.net/mvcb/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>All Blogs - Author(s): Christiaan Baes (chrissie1)</title>
		<link>http://blogs.lessthandot.com/index.php/All/</link>
		<atom:link rel="self" type="application/rss+xml" href="http://blogs.lessthandot.com/index.php/All/?tempskin=_rss2" />
		<description>LessThanDot A Technical Community for IT Professionals</description>
		<language>en-US</language>
		<docs>http://blogs.law.harvard.edu/tech/rss</docs>
		<admin:generatorAgent rdf:resource="http://b2evolution.net/?v=4.0.3"/>
		<ttl>60</ttl>
				<item>
			<title>There are now Visual studio project templates for Nancy</title>
			<link>http://blogs.lessthandot.com/index.php/WebDev/ServerProgramming/there-are-now-visual-studio</link>
			<pubDate>Wed, 01 May 2013 11:11:00 +0000</pubDate>			<dc:creator>Christiaan Baes (chrissie1)</dc:creator>
			<category domain="main">Server Programming</category>
<category domain="alt">ASP.NET</category>			<guid isPermaLink="false">2189@http://blogs.lessthandot.com/</guid>
						<description>&lt;p&gt;We all know and love &lt;a href=&quot;http://nancyfx.org&quot;&gt;Nancy &lt;/a&gt;by now. I love it anyway.&lt;/p&gt;

&lt;p&gt;Up until now you needed to create an empty ASP.Net project and go from there. &lt;/p&gt;

&lt;p&gt;But now you there are templates to make it easier for you to start a new Nancy project.&lt;/p&gt;

&lt;p&gt;For now only C#.&lt;/p&gt;

&lt;p&gt;You will have to download the vsix from the &lt;a href=&quot;http://visualstudiogallery.msdn.microsoft.com/f1e29f61-4dff-4b1e-a14b-6bd0d307611a/&quot;&gt;visual studio gallery&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The restart your VS if it was open.&lt;/p&gt;

&lt;p&gt;If you know try to create a new project you will see this list in the web category.&lt;/p&gt;

&lt;div class=&quot;image_block&quot;&gt;&lt;a href=&quot;http://blogs.lessthandot.com/media/users/chrissie1/nancy/nancytemplates1.png?mtime=1367406283&quot;&gt;&lt;img alt=&quot;&quot; src=&quot;http://blogs.lessthandot.com/media/users/chrissie1/nancy/nancytemplates1.png?mtime=1367406283&quot; width=&quot;955&quot; height=&quot;660&quot; /&gt;&lt;/a&gt;&lt;/div&gt;

&lt;p&gt;Here I created a Nancy project with ASP.Net hosting and Razor. &lt;/p&gt;

&lt;p&gt;Here are the files it creates.&lt;/p&gt;
&lt;div class=&quot;image_block&quot;&gt;&lt;a href=&quot;http://blogs.lessthandot.com/media/users/chrissie1/nancy/nancytemplates2.png?mtime=1367406551&quot;&gt;&lt;img alt=&quot;&quot; src=&quot;http://blogs.lessthandot.com/media/users/chrissie1/nancy/nancytemplates2.png?mtime=1367406551&quot; width=&quot;274&quot; height=&quot;435&quot; /&gt;&lt;/a&gt;&lt;/div&gt;

&lt;p&gt;And here is the module it creates.&lt;/p&gt;

&lt;div class=&quot;image_block&quot;&gt;&lt;a href=&quot;http://blogs.lessthandot.com/media/users/chrissie1/nancy/nancytemplates3.png?mtime=1367406566&quot;&gt;&lt;img alt=&quot;&quot; src=&quot;http://blogs.lessthandot.com/media/users/chrissie1/nancy/nancytemplates3.png?mtime=1367406566&quot; width=&quot;333&quot; height=&quot;247&quot; /&gt;&lt;/a&gt;&lt;/div&gt;

&lt;p&gt;I&#039;ll leave it a surprise for you to discover what is in the other files and project. But needless to say I like.&lt;/p&gt;

&lt;p&gt;Thanks to the whole Nancy team for all the hard work.&lt;/p&gt;&lt;div class=&quot;item_footer&quot;&gt;&lt;p&gt;&lt;small&gt;&lt;a href=&quot;http://blogs.lessthandot.com/index.php/WebDev/ServerProgramming/there-are-now-visual-studio&quot;&gt;Original post&lt;/a&gt; blogged on &lt;a href=&quot;http://lessthandot.com/&quot;&gt;LessThanDot&lt;/a&gt;.&lt;/small&gt;&lt;/p&gt;&lt;/div&gt;</description>
			<content:encoded><![CDATA[<p>We all know and love <a href="http://nancyfx.org">Nancy </a>by now. I love it anyway.</p>

<p>Up until now you needed to create an empty ASP.Net project and go from there. </p>

<p>But now you there are templates to make it easier for you to start a new Nancy project.</p>

<p>For now only C#.</p>

<p>You will have to download the vsix from the <a href="http://visualstudiogallery.msdn.microsoft.com/f1e29f61-4dff-4b1e-a14b-6bd0d307611a/">visual studio gallery</a>.</p>

<p>The restart your VS if it was open.</p>

<p>If you know try to create a new project you will see this list in the web category.</p>

<div class="image_block"><a href="http://blogs.lessthandot.com/media/users/chrissie1/nancy/nancytemplates1.png?mtime=1367406283"><img alt="" src="http://blogs.lessthandot.com/media/users/chrissie1/nancy/nancytemplates1.png?mtime=1367406283" width="955" height="660" /></a></div>

<p>Here I created a Nancy project with ASP.Net hosting and Razor. </p>

<p>Here are the files it creates.</p>
<div class="image_block"><a href="http://blogs.lessthandot.com/media/users/chrissie1/nancy/nancytemplates2.png?mtime=1367406551"><img alt="" src="http://blogs.lessthandot.com/media/users/chrissie1/nancy/nancytemplates2.png?mtime=1367406551" width="274" height="435" /></a></div>

<p>And here is the module it creates.</p>

<div class="image_block"><a href="http://blogs.lessthandot.com/media/users/chrissie1/nancy/nancytemplates3.png?mtime=1367406566"><img alt="" src="http://blogs.lessthandot.com/media/users/chrissie1/nancy/nancytemplates3.png?mtime=1367406566" width="333" height="247" /></a></div>

<p>I'll leave it a surprise for you to discover what is in the other files and project. But needless to say I like.</p>

<p>Thanks to the whole Nancy team for all the hard work.</p><div class="item_footer"><p><small><a href="http://blogs.lessthandot.com/index.php/WebDev/ServerProgramming/there-are-now-visual-studio">Original post</a> blogged on <a href="http://lessthandot.com/">LessThanDot</a>.</small></p></div>]]></content:encoded>
								<comments>http://blogs.lessthandot.com/index.php/WebDev/ServerProgramming/there-are-now-visual-studio#comments</comments>
			<wfw:commentRss>http://blogs.lessthandot.com/index.php/WebDev/?tempskin=_rss2&#38;disp=comments&#38;p=2189</wfw:commentRss>
		</item>
				<item>
			<title>Fody Anotar weaving and logging combined into one package.</title>
			<link>http://blogs.lessthandot.com/index.php/DesktopDev/MSTech/VBNET/fody-anotar-weaving-and-logging</link>
			<pubDate>Thu, 25 Apr 2013 06:53:00 +0000</pubDate>			<dc:creator>Christiaan Baes (chrissie1)</dc:creator>
			<category domain="alt">Microsoft Technologies</category>
<category domain="main">VB.NET</category>			<guid isPermaLink="false">2183@http://blogs.lessthandot.com/</guid>
						<description>&lt;h2&gt;Introduction&lt;/h2&gt;

&lt;p&gt;I said it once and I will say it again. Logging is very important once your app goes live. It&#039;s the best way for you to find out what the user did to destroy your sanity. &lt;br /&gt;
I am always on the lookout for new and exiting things that will make logging easier for me. I want less code but maximum information. &lt;br /&gt;
You can get lots of information with &lt;a href=&quot;http://blogs.lessthandot.com/index.php/All/?p=2162&quot;&gt;Gibraltar&#039;s Loupe&lt;/a&gt; but you can get even less code and more information with &lt;a href=&quot;https://github.com/Fody/Anotar&quot;&gt;Anotar&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;The code&lt;/h2&gt;

&lt;p&gt;It&#039;s easy.&lt;/p&gt;

&lt;p&gt;Just add the Anotar.Nlog package from nuget and then add some config for nlog. Like this.&lt;/p&gt;

&lt;div class=&quot;codebox&quot;&gt;&lt;div class=&quot;codeheader&quot;&gt;Code: &lt;span&gt;xml&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;codeholder&quot;&gt;&lt;div class=&quot;xml&quot; id=&quot;cb95695&quot; style=&quot;display: block; color: rgb(0, 0, 0);&quot;&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&lt;span style=&quot;font-weight: bold; color: black;&quot;&gt;&amp;lt;?xml&lt;/span&gt; &lt;span style=&quot;color: #000066;&quot;&gt;version&lt;/span&gt;=&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;1.0&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #000066;&quot;&gt;encoding&lt;/span&gt;=&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;utf-8&amp;quot;&lt;/span&gt; &lt;span style=&quot;font-weight: bold; color: black;&quot;&gt;?&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&lt;span style=&quot;font-weight: bold; color: black;&quot;&gt;&amp;lt;configuration&lt;span style=&quot;font-weight: bold; color: black;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &lt;span style=&quot;color: #009900;&quot;&gt;&lt;span style=&quot;font-weight: bold; color: black;&quot;&gt;&amp;lt;configSections&lt;span style=&quot;font-weight: bold; color: black;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #009900;&quot;&gt;&lt;span style=&quot;font-weight: bold; color: black;&quot;&gt;&amp;lt;section&lt;/span&gt; &lt;span style=&quot;color: #000066;&quot;&gt;name&lt;/span&gt;=&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;nlog&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #000066;&quot;&gt;type&lt;/span&gt;=&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;NLog.Config.ConfigSectionHandler, NLog&amp;quot;&lt;/span&gt;&lt;span style=&quot;font-weight: bold; color: black;&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &lt;span style=&quot;color: #009900;&quot;&gt;&lt;span style=&quot;font-weight: bold; color: black;&quot;&gt;&amp;lt;/configSections&lt;span style=&quot;font-weight: bold; color: black;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &lt;span style=&quot;color: #009900;&quot;&gt;&lt;span style=&quot;font-weight: bold; color: black;&quot;&gt;&amp;lt;startup&lt;span style=&quot;font-weight: bold; color: black;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #009900;&quot;&gt;&lt;span style=&quot;font-weight: bold; color: black;&quot;&gt;&amp;lt;supportedRuntime&lt;/span&gt; &lt;span style=&quot;color: #000066;&quot;&gt;version&lt;/span&gt;=&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;v4.0&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #000066;&quot;&gt;sku&lt;/span&gt;=&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;.NETFramework,Version=v4.5&amp;quot;&lt;/span&gt;&lt;span style=&quot;font-weight: bold; color: black;&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &lt;span style=&quot;color: #009900;&quot;&gt;&lt;span style=&quot;font-weight: bold; color: black;&quot;&gt;&amp;lt;/startup&lt;span style=&quot;font-weight: bold; color: black;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &lt;span style=&quot;color: #009900;&quot;&gt;&lt;span style=&quot;font-weight: bold; color: black;&quot;&gt;&amp;lt;system&lt;/span&gt;.serviceModel&lt;span style=&quot;font-weight: bold; color: black;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #009900;&quot;&gt;&lt;span style=&quot;font-weight: bold; color: black;&quot;&gt;&amp;lt;bindings&lt;/span&gt;&lt;span style=&quot;font-weight: bold; color: black;&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #009900;&quot;&gt;&lt;span style=&quot;font-weight: bold; color: black;&quot;&gt;&amp;lt;client&lt;/span&gt;&lt;span style=&quot;font-weight: bold; color: black;&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &lt;span style=&quot;color: #009900;&quot;&gt;&lt;span style=&quot;font-weight: bold; color: black;&quot;&gt;&amp;lt;/system&lt;/span&gt;.serviceModel&lt;span style=&quot;font-weight: bold; color: black;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &lt;span style=&quot;color: #009900;&quot;&gt;&lt;span style=&quot;font-weight: bold; color: black;&quot;&gt;&amp;lt;nlog&lt;span style=&quot;font-weight: bold; color: black;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #009900;&quot;&gt;&lt;span style=&quot;font-weight: bold; color: black;&quot;&gt;&amp;lt;targets&lt;span style=&quot;font-weight: bold; color: black;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #009900;&quot;&gt;&lt;span style=&quot;font-weight: bold; color: black;&quot;&gt;&amp;lt;target&lt;/span&gt; &lt;span style=&quot;color: #000066;&quot;&gt;name&lt;/span&gt;=&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;file&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #000066;&quot;&gt;type&lt;/span&gt;=&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;File&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #000066;&quot;&gt;fileName&lt;/span&gt;=&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;_${level}.log&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #000066;&quot;&gt;layout&lt;/span&gt;=&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;${longdate} ${threadid} [${level:uppercase=true}] ${message}&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #000066;&quot;&gt;archiveFileName&lt;/span&gt;=&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;_${level}.{#}.log&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #000066;&quot;&gt;archiveAboveSize&lt;/span&gt;=&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;1048576&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #000066;&quot;&gt;archiveNumbering&lt;/span&gt;=&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;Sequence&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #000066;&quot;&gt;maxArchiveFiles&lt;/span&gt;=&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;10&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #000066;&quot;&gt;concurrentWrites&lt;/span&gt;=&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;true&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #000066;&quot;&gt;keepFileOpen&lt;/span&gt;=&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;false&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #000066;&quot;&gt;encoding&lt;/span&gt;=&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;iso-8859-2&amp;quot;&lt;/span&gt;&lt;span style=&quot;font-weight: bold; color: black;&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #009900;&quot;&gt;&lt;span style=&quot;font-weight: bold; color: black;&quot;&gt;&amp;lt;/targets&lt;span style=&quot;font-weight: bold; color: black;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #009900;&quot;&gt;&lt;span style=&quot;font-weight: bold; color: black;&quot;&gt;&amp;lt;rules&lt;span style=&quot;font-weight: bold; color: black;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #009900;&quot;&gt;&lt;span style=&quot;font-weight: bold; color: black;&quot;&gt;&amp;lt;logger&lt;/span&gt; &lt;span style=&quot;color: #000066;&quot;&gt;name&lt;/span&gt;=&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;*&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #000066;&quot;&gt;minlevel&lt;/span&gt;=&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;Debug&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #000066;&quot;&gt;writeTo&lt;/span&gt;=&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;file&amp;quot;&lt;/span&gt;&lt;span style=&quot;font-weight: bold; color: black;&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #009900;&quot;&gt;&lt;span style=&quot;font-weight: bold; color: black;&quot;&gt;&amp;lt;/rules&lt;span style=&quot;font-weight: bold; color: black;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &lt;span style=&quot;color: #009900;&quot;&gt;&lt;span style=&quot;font-weight: bold; color: black;&quot;&gt;&amp;lt;/nlog&lt;span style=&quot;font-weight: bold; color: black;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&lt;span style=&quot;font-weight: bold; color: black;&quot;&gt;&amp;lt;/configuration&lt;span style=&quot;font-weight: bold; color: black;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div id=&quot;cb14306&quot; style=&quot;display: none; color: red;&quot;&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;And try it with this code.&lt;/p&gt;

&lt;div class=&quot;codebox&quot;&gt;&lt;div class=&quot;codeheader&quot;&gt;Code: &lt;span&gt;vbnet&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;codeholder&quot;&gt;&lt;div class=&quot;vbnet&quot; id=&quot;cb95680&quot; style=&quot;display: block; color: rgb(0, 0, 0);&quot;&gt;&lt;span style=&quot;color: #0600FF;&quot;&gt;Module&lt;/span&gt; Module1&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;Sub&lt;/span&gt; Main&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;Dim&lt;/span&gt; l &lt;span style=&quot;color: #0600FF;&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;New&lt;/span&gt; Logthing&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; l.&lt;span style=&quot;color: #000000;&quot;&gt;TestSub&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Console.&lt;span style=&quot;color: #000000;&quot;&gt;WriteLine&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;l.&lt;span style=&quot;color: #000000;&quot;&gt;TestFunction&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Anotar.&lt;span style=&quot;color: #000000;&quot;&gt;NLog&lt;/span&gt;.&lt;span style=&quot;color: #000000;&quot;&gt;Log&lt;/span&gt;.&lt;span style=&quot;color: #000000;&quot;&gt;Info&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0600FF;&quot;&gt;&amp;quot;Some info in a static method&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;End&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;Sub&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;Public&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;Class&lt;/span&gt; Logthing&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;Public&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;Sub&lt;/span&gt; TestSub&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Anotar.&lt;span style=&quot;color: #000000;&quot;&gt;NLog&lt;/span&gt;.&lt;span style=&quot;color: #000000;&quot;&gt;Log&lt;/span&gt;.&lt;span style=&quot;color: #000000;&quot;&gt;Debug&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0600FF;&quot;&gt;&amp;quot;My message for sub&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;End&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;Sub&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;Public&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;Function&lt;/span&gt; TestFunction&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;String&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Anotar.&lt;span style=&quot;color: #000000;&quot;&gt;NLog&lt;/span&gt;.&lt;span style=&quot;color: #000000;&quot;&gt;Log&lt;/span&gt;.&lt;span style=&quot;color: #000000;&quot;&gt;Debug&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0600FF;&quot;&gt;&amp;quot;My message for function&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Return &lt;span style=&quot;color: #0600FF;&quot;&gt;&amp;quot;This thing&amp;quot;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;End&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;Function&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;End&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;Class&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&lt;span style=&quot;color: #0600FF;&quot;&gt;End&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;Module&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div id=&quot;cb58820&quot; style=&quot;display: none; color: red;&quot;&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;This is then the resulting debug log file.&lt;/p&gt;

&lt;blockquote&gt;&lt;p&gt;2013-04-25 13:24:00.1197 8 [DEBUG] Method: &#039;System.Void ConsoleApplication1.Module1/Logthing::TestSub()&#039;. Line: ~12. My message for sub&lt;br /&gt;
2013-04-25 13:24:00.1387 8 [DEBUG] Method: &#039;System.String ConsoleApplication1.Module1/Logthing::TestFunction()&#039;. Line: ~16. My message for function&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;And the info file.&lt;/p&gt;

&lt;blockquote&gt;&lt;p&gt;2013-04-25 13:24:00.1387 8 [INFO] Method: &#039;System.Void ConsoleApplication1.Module1::Main()&#039;. Line: ~7. Some info in a static method&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;The lines seem to be correct and the other information too. &lt;/p&gt;

&lt;p&gt;But how does Fody do it?&lt;/p&gt;

&lt;p&gt;Well, it changes your code at compile time. &lt;/p&gt;

&lt;p&gt;This for instance is the LogThing class after a decompile by JustDecompile.&lt;/p&gt;

&lt;div class=&quot;codebox&quot;&gt;&lt;div class=&quot;codeheader&quot;&gt;Code: &lt;span&gt;vbnet&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;codeholder&quot;&gt;&lt;div class=&quot;vbnet&quot; id=&quot;cb3978&quot; style=&quot;display: block; color: rgb(0, 0, 0);&quot;&gt;&lt;span style=&quot;color: #0600FF;&quot;&gt;Public&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;Class&lt;/span&gt; Logthing&lt;br /&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;Private&lt;/span&gt; Shared AnotarLogger &lt;span style=&quot;color: #0600FF;&quot;&gt;As&lt;/span&gt; Logger&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp; &amp;nbsp; Shared &lt;span style=&quot;color: #0600FF;&quot;&gt;Sub&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;New&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Logthing.&lt;span style=&quot;color: #000000;&quot;&gt;AnotarLogger&lt;/span&gt; = LogManager.&lt;span style=&quot;color: #000000;&quot;&gt;GetLogger&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0600FF;&quot;&gt;&amp;quot;ConsoleApplication1.Module1/Logthing&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;End&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;Sub&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;lt;DebuggerNonUserCode&amp;gt; _&lt;br /&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;Public&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;Sub&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;New&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;MyBase&lt;/span&gt;.&lt;span style=&quot;color: #0600FF;&quot;&gt;New&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;End&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;Sub&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;Public&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;Function&lt;/span&gt; TestFunction&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;String&lt;/span&gt; &lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;Dim&lt;/span&gt; V_2 &lt;span style=&quot;color: #0600FF;&quot;&gt;As&lt;/span&gt; Object&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt; = &lt;span style=&quot;color: #0600FF;&quot;&gt;New&lt;/span&gt; Object&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #FF0000;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;Dim&lt;/span&gt; V_1 &lt;span style=&quot;color: #0600FF;&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;String&lt;/span&gt; = &lt;span style=&quot;color: #0600FF;&quot;&gt;&amp;quot;My message for function&amp;quot;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; V_1 = &lt;span style=&quot;color: #0600FF;&quot;&gt;String&lt;/span&gt;.&lt;span style=&quot;color: #000000;&quot;&gt;Concat&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0600FF;&quot;&gt;&amp;quot;Method: &#039;System.String ConsoleApplication1.Module1/Logthing::TestFunction()&#039;. Line: ~16. &amp;quot;&lt;/span&gt;, V_1&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Logthing.&lt;span style=&quot;color: #000000;&quot;&gt;AnotarLogger&lt;/span&gt;.&lt;span style=&quot;color: #000000;&quot;&gt;Debug&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;V_1, V_2&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;Dim&lt;/span&gt; TestFunction &lt;span style=&quot;color: #0600FF;&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;String&lt;/span&gt; = &lt;span style=&quot;color: #0600FF;&quot;&gt;&amp;quot;This thing&amp;quot;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Return TestFunction&lt;br /&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;End&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;Function&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;Public&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;Sub&lt;/span&gt; TestSub&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;Dim&lt;/span&gt; V_1 &lt;span style=&quot;color: #0600FF;&quot;&gt;As&lt;/span&gt; Object&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt; = &lt;span style=&quot;color: #0600FF;&quot;&gt;New&lt;/span&gt; Object&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #FF0000;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;Dim&lt;/span&gt; V_0 &lt;span style=&quot;color: #0600FF;&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;String&lt;/span&gt; = &lt;span style=&quot;color: #0600FF;&quot;&gt;&amp;quot;My message for sub&amp;quot;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; V_0 = &lt;span style=&quot;color: #0600FF;&quot;&gt;String&lt;/span&gt;.&lt;span style=&quot;color: #000000;&quot;&gt;Concat&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0600FF;&quot;&gt;&amp;quot;Method: &#039;System.Void ConsoleApplication1.Module1/Logthing::TestSub()&#039;. Line: ~12. &amp;quot;&lt;/span&gt;, V_0&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Logthing.&lt;span style=&quot;color: #000000;&quot;&gt;AnotarLogger&lt;/span&gt;.&lt;span style=&quot;color: #000000;&quot;&gt;Debug&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;V_0, V_1&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;End&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;Sub&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #0600FF;&quot;&gt;End&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;Class&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div id=&quot;cb83083&quot; style=&quot;display: none; color: red;&quot;&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;p&gt; &lt;/p&gt;

&lt;p&gt;As you can see it is not doing any reflection in your code. It just replaces your Log.Debug code with other code. Which means it should be faster at runtime. &lt;/p&gt;

&lt;p&gt;This also means that compiling will be slower, because it has to change your code. How much? No idea. &lt;/p&gt;

&lt;h2&gt;Conclusion&lt;/h2&gt;

&lt;p&gt;I like this.&lt;/p&gt;&lt;div class=&quot;item_footer&quot;&gt;&lt;p&gt;&lt;small&gt;&lt;a href=&quot;http://blogs.lessthandot.com/index.php/DesktopDev/MSTech/VBNET/fody-anotar-weaving-and-logging&quot;&gt;Original post&lt;/a&gt; blogged on &lt;a href=&quot;http://lessthandot.com/&quot;&gt;LessThanDot&lt;/a&gt;.&lt;/small&gt;&lt;/p&gt;&lt;/div&gt;</description>
			<content:encoded><![CDATA[<h2>Introduction</h2>

<p>I said it once and I will say it again. Logging is very important once your app goes live. It's the best way for you to find out what the user did to destroy your sanity. <br />
I am always on the lookout for new and exiting things that will make logging easier for me. I want less code but maximum information. <br />
You can get lots of information with <a href="http://blogs.lessthandot.com/index.php/All/?p=2162">Gibraltar's Loupe</a> but you can get even less code and more information with <a href="https://github.com/Fody/Anotar">Anotar</a>.</p>

<h2>The code</h2>

<p>It's easy.</p>

<p>Just add the Anotar.Nlog package from nuget and then add some config for nlog. Like this.</p>

<div class="codebox"><div class="codeheader"><span>xml</span><div class="codebox_javascript_links"><a href="http://blogs.lessthandot.com" onclick="linenumberOnOff('cb41084'); return false;">Line number Off</a> | <a href="http://blogs.lessthandot.com#" onclick="expandCode('cb41084','cb6921'); return false;">Hide</a> | <a href="http://blogs.lessthandot.com#" onclick="selectCode(this); return false;">Select all</a></div></div><!-- we need this dummy div to fix a firefox bug when selecting code lines --><div class="codeholder"><div class="xml" id="cb41084" style="display: block; color: rgb(0, 0, 0);"><ol><li style="" class="li1"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;utf-8&quot;</span> <span style="font-weight: bold; color: black;">?&gt;</span></span></li><li style="" class="li2"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;configuration<span style="font-weight: bold; color: black;">&gt;</span></span></span></li><li style="" class="li1">&nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;configSections<span style="font-weight: bold; color: black;">&gt;</span></span></span></li><li style="" class="li2">&nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;section</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;nlog&quot;</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;NLog.Config.ConfigSectionHandler, NLog&quot;</span><span style="font-weight: bold; color: black;">/&gt;</span></span></li><li style="" class="li1">&nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/configSections<span style="font-weight: bold; color: black;">&gt;</span></span></span></li><li style="" class="li2">&nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;startup<span style="font-weight: bold; color: black;">&gt;</span></span></span></li><li style="" class="li1">&nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;supportedRuntime</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;v4.0&quot;</span> <span style="color: #000066;">sku</span>=<span style="color: #ff0000;">&quot;.NETFramework,Version=v4.5&quot;</span><span style="font-weight: bold; color: black;">/&gt;</span></span></li><li style="" class="li2">&nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/startup<span style="font-weight: bold; color: black;">&gt;</span></span></span></li><li style="" class="li1">&nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;system</span>.serviceModel<span style="font-weight: bold; color: black;">&gt;</span></span></li><li style="" class="li2">&nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;bindings</span><span style="font-weight: bold; color: black;">/&gt;</span></span></li><li style="" class="li1">&nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;client</span><span style="font-weight: bold; color: black;">/&gt;</span></span></li><li style="" class="li2">&nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/system</span>.serviceModel<span style="font-weight: bold; color: black;">&gt;</span></span></li><li style="" class="li1">&nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;nlog<span style="font-weight: bold; color: black;">&gt;</span></span></span></li><li style="" class="li2">&nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;targets<span style="font-weight: bold; color: black;">&gt;</span></span></span></li><li style="" class="li1">&nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;target</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;file&quot;</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;File&quot;</span> <span style="color: #000066;">fileName</span>=<span style="color: #ff0000;">&quot;_${level}.log&quot;</span> <span style="color: #000066;">layout</span>=<span style="color: #ff0000;">&quot;${longdate} ${threadid} [${level:uppercase=true}] ${message}&quot;</span> <span style="color: #000066;">archiveFileName</span>=<span style="color: #ff0000;">&quot;_${level}.{#}.log&quot;</span> <span style="color: #000066;">archiveAboveSize</span>=<span style="color: #ff0000;">&quot;1048576&quot;</span> <span style="color: #000066;">archiveNumbering</span>=<span style="color: #ff0000;">&quot;Sequence&quot;</span> <span style="color: #000066;">maxArchiveFiles</span>=<span style="color: #ff0000;">&quot;10&quot;</span> <span style="color: #000066;">concurrentWrites</span>=<span style="color: #ff0000;">&quot;true&quot;</span> <span style="color: #000066;">keepFileOpen</span>=<span style="color: #ff0000;">&quot;false&quot;</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;iso-8859-2&quot;</span><span style="font-weight: bold; color: black;">/&gt;</span></span></li><li style="" class="li2">&nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/targets<span style="font-weight: bold; color: black;">&gt;</span></span></span></li><li style="" class="li1">&nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;rules<span style="font-weight: bold; color: black;">&gt;</span></span></span></li><li style="" class="li2">&nbsp; &nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;logger</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;*&quot;</span> <span style="color: #000066;">minlevel</span>=<span style="color: #ff0000;">&quot;Debug&quot;</span> <span style="color: #000066;">writeTo</span>=<span style="color: #ff0000;">&quot;file&quot;</span><span style="font-weight: bold; color: black;">/&gt;</span></span></li><li style="" class="li1">&nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/rules<span style="font-weight: bold; color: black;">&gt;</span></span></span></li><li style="" class="li2">&nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/nlog<span style="font-weight: bold; color: black;">&gt;</span></span></span></li><li style="" class="li1"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/configuration<span style="font-weight: bold; color: black;">&gt;</span></span></span></li></ol></div><div id="cb6921" style="display: none; color: red;"></div></div></div>

<p>And try it with this code.</p>

<div class="codebox"><div class="codeheader"><span>vbnet</span><div class="codebox_javascript_links"><a href="http://blogs.lessthandot.com" onclick="linenumberOnOff('cb91552'); return false;">Line number Off</a> | <a href="http://blogs.lessthandot.com#" onclick="expandCode('cb91552','cb2537'); return false;">Hide</a> | <a href="http://blogs.lessthandot.com#" onclick="selectCode(this); return false;">Select all</a></div></div><!-- we need this dummy div to fix a firefox bug when selecting code lines --><div class="codeholder"><div class="vbnet" id="cb91552" style="display: block; color: rgb(0, 0, 0);"><ol><li style="" class="li1"><span style="color: #0600FF;">Module</span> Module1</li><li style="" class="li2">&nbsp;</li><li style="" class="li1">&nbsp; &nbsp; <span style="color: #0600FF;">Sub</span> Main<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span></li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Dim</span> l <span style="color: #0600FF;">As</span> <span style="color: #0600FF;">New</span> Logthing</li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; l.<span style="color: #000000;">TestSub</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span></li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; Console.<span style="color: #000000;">WriteLine</span><span style="color: #000000;">&#40;</span>l.<span style="color: #000000;">TestFunction</span><span style="color: #000000;">&#41;</span></li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; Anotar.<span style="color: #000000;">NLog</span>.<span style="color: #000000;">Log</span>.<span style="color: #000000;">Info</span><span style="color: #000000;">&#40;</span><span style="color: #0600FF;">&quot;Some info in a static method&quot;</span><span style="color: #000000;">&#41;</span></li><li style="" class="li2">&nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Sub</span></li><li style="" class="li1">&nbsp;</li><li style="" class="li2">&nbsp; &nbsp; <span style="color: #0600FF;">Public</span> <span style="color: #0600FF;">Class</span> Logthing</li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Public</span> <span style="color: #0600FF;">Sub</span> TestSub<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span></li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Anotar.<span style="color: #000000;">NLog</span>.<span style="color: #000000;">Log</span>.<span style="color: #000000;">Debug</span><span style="color: #000000;">&#40;</span><span style="color: #0600FF;">&quot;My message for sub&quot;</span><span style="color: #000000;">&#41;</span></li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Sub</span></li><li style="" class="li2">&nbsp;</li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Public</span> <span style="color: #0600FF;">Function</span> TestFunction<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #0600FF;">As</span> <span style="color: #0600FF;">String</span></li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Anotar.<span style="color: #000000;">NLog</span>.<span style="color: #000000;">Log</span>.<span style="color: #000000;">Debug</span><span style="color: #000000;">&#40;</span><span style="color: #0600FF;">&quot;My message for function&quot;</span><span style="color: #000000;">&#41;</span></li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Return <span style="color: #0600FF;">&quot;This thing&quot;</span></li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Function</span></li><li style="" class="li1">&nbsp;</li><li style="" class="li2">&nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Class</span></li><li style="" class="li1">&nbsp;</li><li style="" class="li2"><span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Module</span></li></ol></div><div id="cb2537" style="display: none; color: red;"></div></div></div>

<p>This is then the resulting debug log file.</p>

<blockquote><p>2013-04-25 13:24:00.1197 8 [DEBUG] Method: 'System.Void ConsoleApplication1.Module1/Logthing::TestSub()'. Line: ~12. My message for sub<br />
2013-04-25 13:24:00.1387 8 [DEBUG] Method: 'System.String ConsoleApplication1.Module1/Logthing::TestFunction()'. Line: ~16. My message for function</p></blockquote>

<p>And the info file.</p>

<blockquote><p>2013-04-25 13:24:00.1387 8 [INFO] Method: 'System.Void ConsoleApplication1.Module1::Main()'. Line: ~7. Some info in a static method</p></blockquote>

<p>The lines seem to be correct and the other information too. </p>

<p>But how does Fody do it?</p>

<p>Well, it changes your code at compile time. </p>

<p>This for instance is the LogThing class after a decompile by JustDecompile.</p>

<div class="codebox"><div class="codeheader"><span>vbnet</span><div class="codebox_javascript_links"><a href="http://blogs.lessthandot.com" onclick="linenumberOnOff('cb12270'); return false;">Line number Off</a> | <a href="http://blogs.lessthandot.com#" onclick="expandCode('cb12270','cb61457'); return false;">Hide</a> | <a href="http://blogs.lessthandot.com#" onclick="selectCode(this); return false;">Select all</a></div></div><!-- we need this dummy div to fix a firefox bug when selecting code lines --><div class="codeholder"><div class="vbnet" id="cb12270" style="display: block; color: rgb(0, 0, 0);"><ol><li style="" class="li1"><span style="color: #0600FF;">Public</span> <span style="color: #0600FF;">Class</span> Logthing</li><li style="" class="li2">&nbsp; &nbsp; <span style="color: #0600FF;">Private</span> Shared AnotarLogger <span style="color: #0600FF;">As</span> Logger</li><li style="" class="li1">&nbsp;</li><li style="" class="li2">&nbsp; &nbsp; Shared <span style="color: #0600FF;">Sub</span> <span style="color: #0600FF;">New</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span></li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; Logthing.<span style="color: #000000;">AnotarLogger</span> = LogManager.<span style="color: #000000;">GetLogger</span><span style="color: #000000;">&#40;</span><span style="color: #0600FF;">&quot;ConsoleApplication1.Module1/Logthing&quot;</span><span style="color: #000000;">&#41;</span></li><li style="" class="li2">&nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Sub</span></li><li style="" class="li1">&nbsp;</li><li style="" class="li2">&nbsp; &nbsp; &lt;DebuggerNonUserCode&gt; _</li><li style="" class="li1">&nbsp; &nbsp; <span style="color: #0600FF;">Public</span> <span style="color: #0600FF;">Sub</span> <span style="color: #0600FF;">New</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span></li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">MyBase</span>.<span style="color: #0600FF;">New</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span></li><li style="" class="li1">&nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Sub</span></li><li style="" class="li2">&nbsp;</li><li style="" class="li1">&nbsp; &nbsp; <span style="color: #0600FF;">Public</span> <span style="color: #0600FF;">Function</span> TestFunction<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #0600FF;">As</span> <span style="color: #0600FF;">String</span> </li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Dim</span> V_2 <span style="color: #0600FF;">As</span> Object<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> = <span style="color: #0600FF;">New</span> Object<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">0</span><span style="color: #000000;">&#41;</span></li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Dim</span> V_1 <span style="color: #0600FF;">As</span> <span style="color: #0600FF;">String</span> = <span style="color: #0600FF;">&quot;My message for function&quot;</span></li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; V_1 = <span style="color: #0600FF;">String</span>.<span style="color: #000000;">Concat</span><span style="color: #000000;">&#40;</span><span style="color: #0600FF;">&quot;Method: 'System.String ConsoleApplication1.Module1/Logthing::TestFunction()'. Line: ~16. &quot;</span>, V_1<span style="color: #000000;">&#41;</span></li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; Logthing.<span style="color: #000000;">AnotarLogger</span>.<span style="color: #000000;">Debug</span><span style="color: #000000;">&#40;</span>V_1, V_2<span style="color: #000000;">&#41;</span></li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Dim</span> TestFunction <span style="color: #0600FF;">As</span> <span style="color: #0600FF;">String</span> = <span style="color: #0600FF;">&quot;This thing&quot;</span></li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; Return TestFunction</li><li style="" class="li2">&nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Function</span></li><li style="" class="li1">&nbsp;</li><li style="" class="li2">&nbsp; &nbsp; <span style="color: #0600FF;">Public</span> <span style="color: #0600FF;">Sub</span> TestSub<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span></li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Dim</span> V_1 <span style="color: #0600FF;">As</span> Object<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> = <span style="color: #0600FF;">New</span> Object<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">0</span><span style="color: #000000;">&#41;</span></li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Dim</span> V_0 <span style="color: #0600FF;">As</span> <span style="color: #0600FF;">String</span> = <span style="color: #0600FF;">&quot;My message for sub&quot;</span></li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; V_0 = <span style="color: #0600FF;">String</span>.<span style="color: #000000;">Concat</span><span style="color: #000000;">&#40;</span><span style="color: #0600FF;">&quot;Method: 'System.Void ConsoleApplication1.Module1/Logthing::TestSub()'. Line: ~12. &quot;</span>, V_0<span style="color: #000000;">&#41;</span></li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; Logthing.<span style="color: #000000;">AnotarLogger</span>.<span style="color: #000000;">Debug</span><span style="color: #000000;">&#40;</span>V_0, V_1<span style="color: #000000;">&#41;</span></li><li style="" class="li1">&nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Sub</span></li><li style="" class="li2"><span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Class</span></li></ol></div><div id="cb61457" style="display: none; color: red;"></div></div></div><p> </p>

<p>As you can see it is not doing any reflection in your code. It just replaces your Log.Debug code with other code. Which means it should be faster at runtime. </p>

<p>This also means that compiling will be slower, because it has to change your code. How much? No idea. </p>

<h2>Conclusion</h2>

<p>I like this.</p><div class="item_footer"><p><small><a href="http://blogs.lessthandot.com/index.php/DesktopDev/MSTech/VBNET/fody-anotar-weaving-and-logging">Original post</a> blogged on <a href="http://lessthandot.com/">LessThanDot</a>.</small></p></div>]]></content:encoded>
								<comments>http://blogs.lessthandot.com/index.php/DesktopDev/MSTech/VBNET/fody-anotar-weaving-and-logging#comments</comments>
			<wfw:commentRss>http://blogs.lessthandot.com/index.php/DesktopDev/?tempskin=_rss2&#38;disp=comments&#38;p=2183</wfw:commentRss>
		</item>
				<item>
			<title>Trying out Gibraltar's Loupe with Nancy</title>
			<link>http://blogs.lessthandot.com/index.php/WebDev/ServerProgramming/trying-out-gibraltar-s-loupe</link>
			<pubDate>Sat, 23 Mar 2013 03:55:00 +0000</pubDate>			<dc:creator>Christiaan Baes (chrissie1)</dc:creator>
			<category domain="main">Server Programming</category>
<category domain="alt">ASP.NET</category>			<guid isPermaLink="false">2162@http://blogs.lessthandot.com/</guid>
						<description>&lt;h2&gt;Introduction&lt;/h2&gt;

&lt;p&gt;I downloaded and tested Gibraltar&#039;s Loupe today and tried to find out what it could add to my application. And because Rachel Hawley asked me t review it, and who am I to refuse her anything.&lt;/p&gt;

&lt;p&gt;I already add as much logging to my application as possible because it makes it a lot easier to find bugs and fix them once you go into productions. &lt;/p&gt;

&lt;p&gt;But log files can get overwhelming sometimes.&lt;/p&gt;

&lt;p&gt;This is where Gibraltar analyst can help. &lt;/p&gt;

&lt;h2&gt;Installation&lt;/h2&gt;

&lt;p&gt;I downloaded the 3.0 preview 3. Installation is easy and for now I only installed the desktopversion, but there is also a webversion.&lt;/p&gt;

&lt;p&gt;I created a small nancy application with the razor viewengine.&lt;/p&gt;

&lt;p&gt;With this as my view.&lt;/p&gt;

&lt;div class=&quot;codebox&quot;&gt;&lt;div class=&quot;codeheader&quot;&gt;Code: &lt;span&gt;html&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;codeholder&quot;&gt;&lt;div class=&quot;html&quot; id=&quot;cb78908&quot; style=&quot;display: block; color: rgb(0, 0, 0);&quot;&gt;&lt;span style=&quot;color: #00bbdd;&quot;&gt;&amp;lt;!DOCTYPE html&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&lt;a href=&quot;http://december.com/html/4/element/html.html&quot;&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;&amp;lt;html&lt;/span&gt;&lt;/a&gt; xmlns=&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;http://www.w3.org/1999/xhtml&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&lt;a href=&quot;http://december.com/html/4/element/head.html&quot;&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;&amp;lt;head&amp;gt;&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #009900;&quot;&gt;&lt;a href=&quot;http://december.com/html/4/element/title.html&quot;&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;&amp;lt;title&amp;gt;&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;&amp;lt;/title&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;&amp;lt;/head&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&lt;a href=&quot;http://december.com/html/4/element/body.html&quot;&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;&amp;lt;body&amp;gt;&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #009900;&quot;&gt;&lt;a href=&quot;http://december.com/html/4/element/p.html&quot;&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;&amp;lt;p&amp;gt;&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;Welcome to OUR world!&lt;span style=&quot;color: #009900;&quot;&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;&amp;lt;/body&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;&amp;lt;/html&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div id=&quot;cb86625&quot; style=&quot;display: none; color: red;&quot;&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;and this as my module.&lt;/p&gt;

&lt;div class=&quot;codebox&quot;&gt;&lt;div class=&quot;codeheader&quot;&gt;Code: &lt;span&gt;vbnet&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;codeholder&quot;&gt;&lt;div class=&quot;vbnet&quot; id=&quot;cb76264&quot; style=&quot;display: block; color: rgb(0, 0, 0);&quot;&gt;Imports Nancy&lt;br /&gt;Imports Gibraltar.&lt;span style=&quot;color: #000000;&quot;&gt;Agent&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&lt;span style=&quot;color: #0600FF;&quot;&gt;Public&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;Class&lt;/span&gt; MainModule&lt;br /&gt;&amp;nbsp; &amp;nbsp; Inherits NancyModule&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;Public&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;Sub&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;New&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;MyBase&lt;/span&gt;.&lt;span style=&quot;color: #0600FF;&quot;&gt;Get&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0600FF;&quot;&gt;&amp;quot;/&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt; = &lt;span style=&quot;color: #0600FF;&quot;&gt;Function&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;parameters&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Return View&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0600FF;&quot;&gt;&amp;quot;Main&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;End&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;Function&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;End&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;Sub&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #0600FF;&quot;&gt;End&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;Class&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div id=&quot;cb65080&quot; style=&quot;display: none; color: red;&quot;&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;I saved all of it and then went into the loupe desktop.&lt;/p&gt;

&lt;div class=&quot;image_block&quot;&gt;&lt;a href=&quot;http://blogs.lessthandot.com/media/users/chrissie1/Loupe/loupe1.png?mtime=1364009122&quot;&gt;&lt;img alt=&quot;&quot; src=&quot;http://blogs.lessthandot.com/media/users/chrissie1/Loupe/loupe1.png?mtime=1364009122&quot; width=&quot;1032&quot; height=&quot;652&quot; /&gt;&lt;/a&gt;&lt;/div&gt;

&lt;p&gt;YOu can now click the big green button that says Add Gribraltar now, point it to your project give it a name and whatnot and voila Gibraltar is there.&lt;/p&gt;

&lt;h2&gt;Logging&lt;/h2&gt;

&lt;p&gt;When I run it and go to live sessions.&lt;br /&gt;
I can see it. &lt;/p&gt;

&lt;div class=&quot;image_block&quot;&gt;&lt;a href=&quot;http://blogs.lessthandot.com/media/users/chrissie1/Loupe/loupe3.png?mtime=1364009498&quot;&gt;&lt;img alt=&quot;&quot; src=&quot;http://blogs.lessthandot.com/media/users/chrissie1/Loupe/loupe3.png?mtime=1364009498&quot; width=&quot;1032&quot; height=&quot;652&quot; /&gt;&lt;/a&gt;&lt;/div&gt;

&lt;p&gt;No idea why it is there twice but you can click one of them.&lt;/p&gt;

&lt;div class=&quot;image_block&quot;&gt;&lt;a href=&quot;http://blogs.lessthandot.com/media/users/chrissie1/Loupe/loupe2.png?mtime=1364009376&quot;&gt;&lt;img alt=&quot;&quot; src=&quot;http://blogs.lessthandot.com/media/users/chrissie1/Loupe/loupe2.png?mtime=1364009376&quot; width=&quot;991&quot; height=&quot;524&quot; /&gt;&lt;/a&gt;&lt;/div&gt;

&lt;p&gt;That&#039;s already more information than we are used to, and we have yet to add logging.&lt;/p&gt;

&lt;p&gt;We can do this by using the Gibraltar Agent logging (but we don&#039;t have to).&lt;/p&gt;

&lt;p&gt;Just add a line like this.&lt;/p&gt;

&lt;div class=&quot;codebox&quot;&gt;&lt;div class=&quot;codeheader&quot;&gt;Code: &lt;span&gt;vbnet&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;codeholder&quot;&gt;&lt;div class=&quot;vbnet&quot; id=&quot;cb33449&quot; style=&quot;display: block; color: rgb(0, 0, 0);&quot;&gt;&lt;span style=&quot;color: #0600FF;&quot;&gt;MyBase&lt;/span&gt;.&lt;span style=&quot;color: #0600FF;&quot;&gt;Get&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0600FF;&quot;&gt;&amp;quot;/&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt; = &lt;span style=&quot;color: #0600FF;&quot;&gt;Function&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;parameters&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Log.&lt;span style=&quot;color: #000000;&quot;&gt;TraceInformation&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0600FF;&quot;&gt;&amp;quot;Opening mainmodule&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Return View&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0600FF;&quot;&gt;&amp;quot;Main&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;End&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;Function&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div id=&quot;cb8630&quot; style=&quot;display: none; color: red;&quot;&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;And next time you run this.&lt;/p&gt;

&lt;p&gt;you will see this in your logging session.&lt;/p&gt;

&lt;div class=&quot;image_block&quot;&gt;&lt;a href=&quot;http://blogs.lessthandot.com/media/users/chrissie1/Loupe/loupe4.png?mtime=1364009881&quot;&gt;&lt;img alt=&quot;&quot; src=&quot;http://blogs.lessthandot.com/media/users/chrissie1/Loupe/loupe4.png?mtime=1364009881&quot; width=&quot;1101&quot; height=&quot;187&quot; /&gt;&lt;/a&gt;&lt;/div&gt;

&lt;p&gt;You can even click on that link and go to your code.&lt;/p&gt;

&lt;p&gt;Or see the code in the tab mainmodule.&lt;/p&gt;

&lt;div class=&quot;image_block&quot;&gt;&lt;a href=&quot;http://blogs.lessthandot.com/media/users/chrissie1/Loupe/loupe5.png?mtime=1364010034&quot;&gt;&lt;img alt=&quot;&quot; src=&quot;http://blogs.lessthandot.com/media/users/chrissie1/Loupe/loupe5.png?mtime=1364010034&quot; width=&quot;652&quot; height=&quot;249&quot; /&gt;&lt;/a&gt;&lt;/div&gt;

&lt;p&gt;That is simple enough.&lt;/p&gt;

&lt;h2&gt;Exceptions&lt;/h2&gt;

&lt;p&gt;So how do we deal with exceptions and unhandled exceptions?&lt;/p&gt;

&lt;p&gt;Let&#039;s add this code to our module.&lt;/p&gt;

&lt;div class=&quot;codebox&quot;&gt;&lt;div class=&quot;codeheader&quot;&gt;Code: &lt;span&gt;vbnet&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;codeholder&quot;&gt;&lt;div class=&quot;vbnet&quot; id=&quot;cb59084&quot; style=&quot;display: block; color: rgb(0, 0, 0);&quot;&gt;&lt;span style=&quot;color: #0600FF;&quot;&gt;MyBase&lt;/span&gt;.&lt;span style=&quot;color: #0600FF;&quot;&gt;Get&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0600FF;&quot;&gt;&amp;quot;/test&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt; = &lt;span style=&quot;color: #0600FF;&quot;&gt;Function&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;parameters&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Try&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;Throw&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;New&lt;/span&gt; Exception&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0600FF;&quot;&gt;&amp;quot;some message loup should pick up&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Catch ex &lt;span style=&quot;color: #0600FF;&quot;&gt;As&lt;/span&gt; Exception&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Log.&lt;span style=&quot;color: #000000;&quot;&gt;TraceError&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;ex, &lt;span style=&quot;color: #0600FF;&quot;&gt;&amp;quot;something&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Return View&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0600FF;&quot;&gt;&amp;quot;Main&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;End&lt;/span&gt; Try&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;End&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;Function&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;MyBase&lt;/span&gt;.&lt;span style=&quot;color: #0600FF;&quot;&gt;Get&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0600FF;&quot;&gt;&amp;quot;/test2&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt; = &lt;span style=&quot;color: #0600FF;&quot;&gt;Function&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;parameters&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #0600FF;&quot;&gt;Throw&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;New&lt;/span&gt; Exception&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0600FF;&quot;&gt;&amp;quot;some message loup should pick up&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #0600FF;&quot;&gt;End&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;Function&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div id=&quot;cb71775&quot; style=&quot;display: none; color: red;&quot;&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;If I now go to the page /test I will see this.&lt;/p&gt;

&lt;div class=&quot;image_block&quot;&gt;&lt;a href=&quot;http://blogs.lessthandot.com/media/users/chrissie1/Loupe/loupe6.png?mtime=1364010367&quot;&gt;&lt;img alt=&quot;&quot; src=&quot;http://blogs.lessthandot.com/media/users/chrissie1/Loupe/loupe6.png?mtime=1364010367&quot; width=&quot;813&quot; height=&quot;199&quot; /&gt;&lt;/a&gt;&lt;/div&gt;

&lt;p&gt;The exception is nicely logged.&lt;/p&gt;

&lt;p&gt;But if I go to page /test2, I see nothing.&lt;/p&gt;

&lt;p&gt;Gibraltar does not log unhandled exception automatically. We either need ELMAH or we need to add logging to an event somewhere.&lt;/p&gt;

&lt;p&gt;Luckily in Nancy this is easy.&lt;/p&gt;

&lt;p&gt;Just add a class that implements IErrorhandler and Nancy will do the rest.&lt;/p&gt;

&lt;div class=&quot;codebox&quot;&gt;&lt;div class=&quot;codeheader&quot;&gt;Code: &lt;span&gt;vbnet&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;codeholder&quot;&gt;&lt;div class=&quot;vbnet&quot; id=&quot;cb25937&quot; style=&quot;display: block; color: rgb(0, 0, 0);&quot;&gt;Imports Nancy&lt;br /&gt;Imports Nancy.&lt;span style=&quot;color: #000000;&quot;&gt;ErrorHandling&lt;/span&gt;&lt;br /&gt;Imports Gibraltar.&lt;span style=&quot;color: #000000;&quot;&gt;Agent&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&lt;span style=&quot;color: #0600FF;&quot;&gt;Public&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;Class&lt;/span&gt; Errorhandler&lt;br /&gt;&amp;nbsp; &amp;nbsp; Implements IErrorHandler&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;Public&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;Function&lt;/span&gt; HandlesStatusCode&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0600FF;&quot;&gt;ByVal&lt;/span&gt; statusCode &lt;span style=&quot;color: #0600FF;&quot;&gt;As&lt;/span&gt; HttpStatusCode, &lt;span style=&quot;color: #0600FF;&quot;&gt;ByVal&lt;/span&gt; context &lt;span style=&quot;color: #0600FF;&quot;&gt;As&lt;/span&gt; NancyContext&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;As&lt;/span&gt; Boolean Implements IStatusCodeHandler.&lt;span style=&quot;color: #000000;&quot;&gt;HandlesStatusCode&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Return statusCode = HttpStatusCode.&lt;span style=&quot;color: #000000;&quot;&gt;InternalServerError&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;End&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;Function&lt;/span&gt;&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;Public&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;Sub&lt;/span&gt; Handle&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0600FF;&quot;&gt;ByVal&lt;/span&gt; statusCode &lt;span style=&quot;color: #0600FF;&quot;&gt;As&lt;/span&gt; HttpStatusCode, &lt;span style=&quot;color: #0600FF;&quot;&gt;ByVal&lt;/span&gt; context &lt;span style=&quot;color: #0600FF;&quot;&gt;As&lt;/span&gt; NancyContext&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt; Implements IStatusCodeHandler.&lt;span style=&quot;color: #000000;&quot;&gt;Handle&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;Dim&lt;/span&gt; errorObject &lt;span style=&quot;color: #0600FF;&quot;&gt;As&lt;/span&gt; Object&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; context.&lt;span style=&quot;color: #000000;&quot;&gt;Items&lt;/span&gt;.&lt;span style=&quot;color: #000000;&quot;&gt;TryGetValue&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;NancyEngine.&lt;span style=&quot;color: #000000;&quot;&gt;ERROR_EXCEPTION&lt;/span&gt;, errorObject&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;Dim&lt;/span&gt; ex = CType&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;errorObject, Exception&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Log.&lt;span style=&quot;color: #000000;&quot;&gt;TraceError&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;ex, &lt;span style=&quot;color: #0600FF;&quot;&gt;&amp;quot;unhandled exception&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;End&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;Sub&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #0600FF;&quot;&gt;End&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;Class&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div id=&quot;cb53786&quot; style=&quot;display: none; color: red;&quot;&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;And now we will see our exception.&lt;/p&gt;

&lt;div class=&quot;image_block&quot;&gt;&lt;a href=&quot;http://blogs.lessthandot.com/media/users/chrissie1/Loupe/loupe7.png?mtime=1364010747&quot;&gt;&lt;img alt=&quot;&quot; src=&quot;http://blogs.lessthandot.com/media/users/chrissie1/Loupe/loupe7.png?mtime=1364010747&quot; width=&quot;798&quot; height=&quot;286&quot; /&gt;&lt;/a&gt;&lt;/div&gt;

&lt;h2&gt;Conclusion&lt;/h2&gt;

&lt;p&gt;Loupe was pretty easy to setup and get going. Loupe does however come at a price. Is that price to high? That depends on the value you place on your business.&lt;/p&gt;&lt;div class=&quot;item_footer&quot;&gt;&lt;p&gt;&lt;small&gt;&lt;a href=&quot;http://blogs.lessthandot.com/index.php/WebDev/ServerProgramming/trying-out-gibraltar-s-loupe&quot;&gt;Original post&lt;/a&gt; blogged on &lt;a href=&quot;http://lessthandot.com/&quot;&gt;LessThanDot&lt;/a&gt;.&lt;/small&gt;&lt;/p&gt;&lt;/div&gt;</description>
			<content:encoded><![CDATA[<h2>Introduction</h2>

<p>I downloaded and tested Gibraltar's Loupe today and tried to find out what it could add to my application. And because Rachel Hawley asked me t review it, and who am I to refuse her anything.</p>

<p>I already add as much logging to my application as possible because it makes it a lot easier to find bugs and fix them once you go into productions. </p>

<p>But log files can get overwhelming sometimes.</p>

<p>This is where Gibraltar analyst can help. </p>

<h2>Installation</h2>

<p>I downloaded the 3.0 preview 3. Installation is easy and for now I only installed the desktopversion, but there is also a webversion.</p>

<p>I created a small nancy application with the razor viewengine.</p>

<p>With this as my view.</p>

<div class="codebox"><div class="codeheader"><span>html</span><div class="codebox_javascript_links"><a href="http://blogs.lessthandot.com" onclick="linenumberOnOff('cb99162'); return false;">Line number Off</a> | <a href="http://blogs.lessthandot.com#" onclick="expandCode('cb99162','cb18429'); return false;">Hide</a> | <a href="http://blogs.lessthandot.com#" onclick="selectCode(this); return false;">Select all</a></div></div><!-- we need this dummy div to fix a firefox bug when selecting code lines --><div class="codeholder"><div class="html" id="cb99162" style="display: block; color: rgb(0, 0, 0);"><ol><li style="" class="li1"><span style="color: #00bbdd;">&lt;!DOCTYPE html&gt;</span></li><li style="" class="li2"><span style="color: #009900;"><a href="http://december.com/html/4/element/html.html"><span style="color: #000000; font-weight: bold;">&lt;html</span></a> xmlns=<span style="color: #ff0000;">&quot;http://www.w3.org/1999/xhtml&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span></li><li style="" class="li1"><span style="color: #009900;"><a href="http://december.com/html/4/element/head.html"><span style="color: #000000; font-weight: bold;">&lt;head&gt;</span></a></span></li><li style="" class="li2">&nbsp; &nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/title.html"><span style="color: #000000; font-weight: bold;">&lt;title&gt;</span></a></span><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/title&gt;</span></span></li><li style="" class="li1"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/head&gt;</span></span></li><li style="" class="li2"><span style="color: #009900;"><a href="http://december.com/html/4/element/body.html"><span style="color: #000000; font-weight: bold;">&lt;body&gt;</span></a></span></li><li style="" class="li1">&nbsp; &nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/p.html"><span style="color: #000000; font-weight: bold;">&lt;p&gt;</span></a></span>Welcome to OUR world!<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/p&gt;</span></span></li><li style="" class="li2"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/body&gt;</span></span></li><li style="" class="li1"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/html&gt;</span></span></li></ol></div><div id="cb18429" style="display: none; color: red;"></div></div></div>

<p>and this as my module.</p>

<div class="codebox"><div class="codeheader"><span>vbnet</span><div class="codebox_javascript_links"><a href="http://blogs.lessthandot.com" onclick="linenumberOnOff('cb67861'); return false;">Line number Off</a> | <a href="http://blogs.lessthandot.com#" onclick="expandCode('cb67861','cb42207'); return false;">Hide</a> | <a href="http://blogs.lessthandot.com#" onclick="selectCode(this); return false;">Select all</a></div></div><!-- we need this dummy div to fix a firefox bug when selecting code lines --><div class="codeholder"><div class="vbnet" id="cb67861" style="display: block; color: rgb(0, 0, 0);"><ol><li style="" class="li1">Imports Nancy</li><li style="" class="li2">Imports Gibraltar.<span style="color: #000000;">Agent</span></li><li style="" class="li1">&nbsp;</li><li style="" class="li2"><span style="color: #0600FF;">Public</span> <span style="color: #0600FF;">Class</span> MainModule</li><li style="" class="li1">&nbsp; &nbsp; Inherits NancyModule</li><li style="" class="li2">&nbsp;</li><li style="" class="li1">&nbsp; &nbsp; <span style="color: #0600FF;">Public</span> <span style="color: #0600FF;">Sub</span> <span style="color: #0600FF;">New</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span></li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">MyBase</span>.<span style="color: #0600FF;">Get</span><span style="color: #000000;">&#40;</span><span style="color: #0600FF;">&quot;/&quot;</span><span style="color: #000000;">&#41;</span> = <span style="color: #0600FF;">Function</span><span style="color: #000000;">&#40;</span>parameters<span style="color: #000000;">&#41;</span></li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Return View<span style="color: #000000;">&#40;</span><span style="color: #0600FF;">&quot;Main&quot;</span><span style="color: #000000;">&#41;</span></li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Function</span></li><li style="" class="li1">&nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Sub</span></li><li style="" class="li2"><span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Class</span></li></ol></div><div id="cb42207" style="display: none; color: red;"></div></div></div>

<p>I saved all of it and then went into the loupe desktop.</p>

<div class="image_block"><a href="http://blogs.lessthandot.com/media/users/chrissie1/Loupe/loupe1.png?mtime=1364009122"><img alt="" src="http://blogs.lessthandot.com/media/users/chrissie1/Loupe/loupe1.png?mtime=1364009122" width="1032" height="652" /></a></div>

<p>YOu can now click the big green button that says Add Gribraltar now, point it to your project give it a name and whatnot and voila Gibraltar is there.</p>

<h2>Logging</h2>

<p>When I run it and go to live sessions.<br />
I can see it. </p>

<div class="image_block"><a href="http://blogs.lessthandot.com/media/users/chrissie1/Loupe/loupe3.png?mtime=1364009498"><img alt="" src="http://blogs.lessthandot.com/media/users/chrissie1/Loupe/loupe3.png?mtime=1364009498" width="1032" height="652" /></a></div>

<p>No idea why it is there twice but you can click one of them.</p>

<div class="image_block"><a href="http://blogs.lessthandot.com/media/users/chrissie1/Loupe/loupe2.png?mtime=1364009376"><img alt="" src="http://blogs.lessthandot.com/media/users/chrissie1/Loupe/loupe2.png?mtime=1364009376" width="991" height="524" /></a></div>

<p>That's already more information than we are used to, and we have yet to add logging.</p>

<p>We can do this by using the Gibraltar Agent logging (but we don't have to).</p>

<p>Just add a line like this.</p>

<div class="codebox"><div class="codeheader"><span>vbnet</span><div class="codebox_javascript_links"><a href="http://blogs.lessthandot.com" onclick="linenumberOnOff('cb79991'); return false;">Line number Off</a> | <a href="http://blogs.lessthandot.com#" onclick="expandCode('cb79991','cb61203'); return false;">Hide</a> | <a href="http://blogs.lessthandot.com#" onclick="selectCode(this); return false;">Select all</a></div></div><!-- we need this dummy div to fix a firefox bug when selecting code lines --><div class="codeholder"><div class="vbnet" id="cb79991" style="display: block; color: rgb(0, 0, 0);"><ol><li style="" class="li1"><span style="color: #0600FF;">MyBase</span>.<span style="color: #0600FF;">Get</span><span style="color: #000000;">&#40;</span><span style="color: #0600FF;">&quot;/&quot;</span><span style="color: #000000;">&#41;</span> = <span style="color: #0600FF;">Function</span><span style="color: #000000;">&#40;</span>parameters<span style="color: #000000;">&#41;</span></li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Log.<span style="color: #000000;">TraceInformation</span><span style="color: #000000;">&#40;</span><span style="color: #0600FF;">&quot;Opening mainmodule&quot;</span><span style="color: #000000;">&#41;</span></li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Return View<span style="color: #000000;">&#40;</span><span style="color: #0600FF;">&quot;Main&quot;</span><span style="color: #000000;">&#41;</span></li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Function</span></li></ol></div><div id="cb61203" style="display: none; color: red;"></div></div></div>

<p>And next time you run this.</p>

<p>you will see this in your logging session.</p>

<div class="image_block"><a href="http://blogs.lessthandot.com/media/users/chrissie1/Loupe/loupe4.png?mtime=1364009881"><img alt="" src="http://blogs.lessthandot.com/media/users/chrissie1/Loupe/loupe4.png?mtime=1364009881" width="1101" height="187" /></a></div>

<p>You can even click on that link and go to your code.</p>

<p>Or see the code in the tab mainmodule.</p>

<div class="image_block"><a href="http://blogs.lessthandot.com/media/users/chrissie1/Loupe/loupe5.png?mtime=1364010034"><img alt="" src="http://blogs.lessthandot.com/media/users/chrissie1/Loupe/loupe5.png?mtime=1364010034" width="652" height="249" /></a></div>

<p>That is simple enough.</p>

<h2>Exceptions</h2>

<p>So how do we deal with exceptions and unhandled exceptions?</p>

<p>Let's add this code to our module.</p>

<div class="codebox"><div class="codeheader"><span>vbnet</span><div class="codebox_javascript_links"><a href="http://blogs.lessthandot.com" onclick="linenumberOnOff('cb93291'); return false;">Line number Off</a> | <a href="http://blogs.lessthandot.com#" onclick="expandCode('cb93291','cb68456'); return false;">Hide</a> | <a href="http://blogs.lessthandot.com#" onclick="selectCode(this); return false;">Select all</a></div></div><!-- we need this dummy div to fix a firefox bug when selecting code lines --><div class="codeholder"><div class="vbnet" id="cb93291" style="display: block; color: rgb(0, 0, 0);"><ol><li style="" class="li1"><span style="color: #0600FF;">MyBase</span>.<span style="color: #0600FF;">Get</span><span style="color: #000000;">&#40;</span><span style="color: #0600FF;">&quot;/test&quot;</span><span style="color: #000000;">&#41;</span> = <span style="color: #0600FF;">Function</span><span style="color: #000000;">&#40;</span>parameters<span style="color: #000000;">&#41;</span></li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Try</li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Throw</span> <span style="color: #0600FF;">New</span> Exception<span style="color: #000000;">&#40;</span><span style="color: #0600FF;">&quot;some message loup should pick up&quot;</span><span style="color: #000000;">&#41;</span></li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Catch ex <span style="color: #0600FF;">As</span> Exception</li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Log.<span style="color: #000000;">TraceError</span><span style="color: #000000;">&#40;</span>ex, <span style="color: #0600FF;">&quot;something&quot;</span><span style="color: #000000;">&#41;</span></li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Return View<span style="color: #000000;">&#40;</span><span style="color: #0600FF;">&quot;Main&quot;</span><span style="color: #000000;">&#41;</span></li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">End</span> Try</li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Function</span></li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">MyBase</span>.<span style="color: #0600FF;">Get</span><span style="color: #000000;">&#40;</span><span style="color: #0600FF;">&quot;/test2&quot;</span><span style="color: #000000;">&#41;</span> = <span style="color: #0600FF;">Function</span><span style="color: #000000;">&#40;</span>parameters<span style="color: #000000;">&#41;</span></li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #0600FF;">Throw</span> <span style="color: #0600FF;">New</span> Exception<span style="color: #000000;">&#40;</span><span style="color: #0600FF;">&quot;some message loup should pick up&quot;</span><span style="color: #000000;">&#41;</span></li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Function</span></li></ol></div><div id="cb68456" style="display: none; color: red;"></div></div></div>

<p>If I now go to the page /test I will see this.</p>

<div class="image_block"><a href="http://blogs.lessthandot.com/media/users/chrissie1/Loupe/loupe6.png?mtime=1364010367"><img alt="" src="http://blogs.lessthandot.com/media/users/chrissie1/Loupe/loupe6.png?mtime=1364010367" width="813" height="199" /></a></div>

<p>The exception is nicely logged.</p>

<p>But if I go to page /test2, I see nothing.</p>

<p>Gibraltar does not log unhandled exception automatically. We either need ELMAH or we need to add logging to an event somewhere.</p>

<p>Luckily in Nancy this is easy.</p>

<p>Just add a class that implements IErrorhandler and Nancy will do the rest.</p>

<div class="codebox"><div class="codeheader"><span>vbnet</span><div class="codebox_javascript_links"><a href="http://blogs.lessthandot.com" onclick="linenumberOnOff('cb35193'); return false;">Line number Off</a> | <a href="http://blogs.lessthandot.com#" onclick="expandCode('cb35193','cb72180'); return false;">Hide</a> | <a href="http://blogs.lessthandot.com#" onclick="selectCode(this); return false;">Select all</a></div></div><!-- we need this dummy div to fix a firefox bug when selecting code lines --><div class="codeholder"><div class="vbnet" id="cb35193" style="display: block; color: rgb(0, 0, 0);"><ol><li style="" class="li1">Imports Nancy</li><li style="" class="li2">Imports Nancy.<span style="color: #000000;">ErrorHandling</span></li><li style="" class="li1">Imports Gibraltar.<span style="color: #000000;">Agent</span></li><li style="" class="li2">&nbsp;</li><li style="" class="li1"><span style="color: #0600FF;">Public</span> <span style="color: #0600FF;">Class</span> Errorhandler</li><li style="" class="li2">&nbsp; &nbsp; Implements IErrorHandler</li><li style="" class="li1">&nbsp;</li><li style="" class="li2">&nbsp; &nbsp; <span style="color: #0600FF;">Public</span> <span style="color: #0600FF;">Function</span> HandlesStatusCode<span style="color: #000000;">&#40;</span><span style="color: #0600FF;">ByVal</span> statusCode <span style="color: #0600FF;">As</span> HttpStatusCode, <span style="color: #0600FF;">ByVal</span> context <span style="color: #0600FF;">As</span> NancyContext<span style="color: #000000;">&#41;</span> <span style="color: #0600FF;">As</span> Boolean Implements IStatusCodeHandler.<span style="color: #000000;">HandlesStatusCode</span></li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; Return statusCode = HttpStatusCode.<span style="color: #000000;">InternalServerError</span></li><li style="" class="li2">&nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Function</span></li><li style="" class="li1">&nbsp;</li><li style="" class="li2">&nbsp; &nbsp; <span style="color: #0600FF;">Public</span> <span style="color: #0600FF;">Sub</span> Handle<span style="color: #000000;">&#40;</span><span style="color: #0600FF;">ByVal</span> statusCode <span style="color: #0600FF;">As</span> HttpStatusCode, <span style="color: #0600FF;">ByVal</span> context <span style="color: #0600FF;">As</span> NancyContext<span style="color: #000000;">&#41;</span> Implements IStatusCodeHandler.<span style="color: #000000;">Handle</span></li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Dim</span> errorObject <span style="color: #0600FF;">As</span> Object</li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; context.<span style="color: #000000;">Items</span>.<span style="color: #000000;">TryGetValue</span><span style="color: #000000;">&#40;</span>NancyEngine.<span style="color: #000000;">ERROR_EXCEPTION</span>, errorObject<span style="color: #000000;">&#41;</span></li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Dim</span> ex = CType<span style="color: #000000;">&#40;</span>errorObject, Exception<span style="color: #000000;">&#41;</span></li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; Log.<span style="color: #000000;">TraceError</span><span style="color: #000000;">&#40;</span>ex, <span style="color: #0600FF;">&quot;unhandled exception&quot;</span><span style="color: #000000;">&#41;</span></li><li style="" class="li1">&nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Sub</span></li><li style="" class="li2"><span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Class</span></li></ol></div><div id="cb72180" style="display: none; color: red;"></div></div></div>

<p>And now we will see our exception.</p>

<div class="image_block"><a href="http://blogs.lessthandot.com/media/users/chrissie1/Loupe/loupe7.png?mtime=1364010747"><img alt="" src="http://blogs.lessthandot.com/media/users/chrissie1/Loupe/loupe7.png?mtime=1364010747" width="798" height="286" /></a></div>

<h2>Conclusion</h2>

<p>Loupe was pretty easy to setup and get going. Loupe does however come at a price. Is that price to high? That depends on the value you place on your business.</p><div class="item_footer"><p><small><a href="http://blogs.lessthandot.com/index.php/WebDev/ServerProgramming/trying-out-gibraltar-s-loupe">Original post</a> blogged on <a href="http://lessthandot.com/">LessThanDot</a>.</small></p></div>]]></content:encoded>
								<comments>http://blogs.lessthandot.com/index.php/WebDev/ServerProgramming/trying-out-gibraltar-s-loupe#comments</comments>
			<wfw:commentRss>http://blogs.lessthandot.com/index.php/WebDev/?tempskin=_rss2&#38;disp=comments&#38;p=2162</wfw:commentRss>
		</item>
				<item>
			<title>Lessthandot has a new server</title>
			<link>http://blogs.lessthandot.com/index.php/ITProfessionals/ProfessionalDevelopment/lessthandot-has-a-new-server</link>
			<pubDate>Thu, 21 Mar 2013 02:25:00 +0000</pubDate>			<dc:creator>Christiaan Baes (chrissie1)</dc:creator>
			<category domain="main">Professional Development</category>			<guid isPermaLink="false">2156@http://blogs.lessthandot.com/</guid>
						<description>&lt;p&gt;You might have noticed a slight glitch in the Matrix yesterday.&lt;/p&gt;

&lt;p&gt;That&#039;s because LessThanDot is now no longer hosted on a dedicated server over at godaddy.com but we moved to &lt;a href=&quot;http://host4geeks.com&quot;&gt;host4geeks&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You might be interested to know that we have moved up in the world.&lt;/p&gt;

&lt;p&gt;Our old server was a dual core intel processor with 2GB RAM and 2x300GB disks with linux on it.&lt;/p&gt;

&lt;p&gt;To our new server being a similar dual core intel celeron processor with 8GB RAM and 2x250GB disks. We needed the RAM more than anything. &lt;/p&gt;

&lt;p&gt;The transition was smooth and not too many people noticed. Except for Ted who lost a few views on his last post, sorry Ted. &lt;/p&gt;

&lt;p&gt;Enjoy.&lt;/p&gt;&lt;div class=&quot;item_footer&quot;&gt;&lt;p&gt;&lt;small&gt;&lt;a href=&quot;http://blogs.lessthandot.com/index.php/ITProfessionals/ProfessionalDevelopment/lessthandot-has-a-new-server&quot;&gt;Original post&lt;/a&gt; blogged on &lt;a href=&quot;http://lessthandot.com/&quot;&gt;LessThanDot&lt;/a&gt;.&lt;/small&gt;&lt;/p&gt;&lt;/div&gt;</description>
			<content:encoded><![CDATA[<p>You might have noticed a slight glitch in the Matrix yesterday.</p>

<p>That's because LessThanDot is now no longer hosted on a dedicated server over at godaddy.com but we moved to <a href="http://host4geeks.com">host4geeks</a></p>

<p>You might be interested to know that we have moved up in the world.</p>

<p>Our old server was a dual core intel processor with 2GB RAM and 2x300GB disks with linux on it.</p>

<p>To our new server being a similar dual core intel celeron processor with 8GB RAM and 2x250GB disks. We needed the RAM more than anything. </p>

<p>The transition was smooth and not too many people noticed. Except for Ted who lost a few views on his last post, sorry Ted. </p>

<p>Enjoy.</p><div class="item_footer"><p><small><a href="http://blogs.lessthandot.com/index.php/ITProfessionals/ProfessionalDevelopment/lessthandot-has-a-new-server">Original post</a> blogged on <a href="http://lessthandot.com/">LessThanDot</a>.</small></p></div>]]></content:encoded>
								<comments>http://blogs.lessthandot.com/index.php/ITProfessionals/ProfessionalDevelopment/lessthandot-has-a-new-server#comments</comments>
			<wfw:commentRss>http://blogs.lessthandot.com/index.php/ITProfessionals/?tempskin=_rss2&#38;disp=comments&#38;p=2156</wfw:commentRss>
		</item>
				<item>
			<title>Crazy stuff I do with Nancy</title>
			<link>http://blogs.lessthandot.com/index.php/WebDev/ServerProgramming/crazy-stuff-i-do-with</link>
			<pubDate>Fri, 15 Mar 2013 12:58:00 +0000</pubDate>			<dc:creator>Christiaan Baes (chrissie1)</dc:creator>
			<category domain="main">Server Programming</category>
<category domain="alt">ASP.NET</category>			<guid isPermaLink="false">2146@http://blogs.lessthandot.com/</guid>
						<description>&lt;p&gt;No, not that.&lt;/p&gt;

&lt;p&gt;I had the need to write documentation for my services. I thought having them as html would be nice and good enough. &lt;/p&gt;

&lt;p&gt;So I made a bunch of vbhtml razorviews because I want my pages to be pretty and use the masterpage I already made for my main site. You know, to be consistent. &lt;/p&gt;

&lt;p&gt;So I had this.&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;page1.vbhtml&lt;/li&gt;
  &lt;li&gt;page2.vbhtml&lt;/li&gt;
  &lt;li&gt;page3.vbhtml&lt;/li&gt;
  &lt;li&gt;page4.vbhtml&lt;/li&gt;
  &lt;li&gt;index.vbhtml&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And to show those pages I just have this in my module.&lt;/p&gt;

&lt;div class=&quot;codebox&quot;&gt;&lt;div class=&quot;codeheader&quot;&gt;Code: &lt;span&gt;text&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;codeholder&quot;&gt;&lt;div class=&quot;text&quot; id=&quot;cb76929&quot; style=&quot;display: block; color: rgb(0, 0, 0);&quot;&gt;MyBase.Get(&amp;quot;/{Title}&amp;quot;) = Function(parameters)&lt;br /&gt;&amp;nbsp; Return Negotiate.WithView(&amp;quot;documentation/&amp;quot; &amp;amp; parameters.Title)&lt;br /&gt;End If&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div id=&quot;cb54542&quot; style=&quot;display: none; color: red;&quot;&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;So calling page1 is as easy as &lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;codespan&quot;&gt;/documentation/page1&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;But what if someone did&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;codespan&quot;&gt;/documentation/page12&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;They would get an error.&lt;/p&gt;

&lt;p&gt;But, meh, I don&#039;t want that. I want them to return to the index instead. &lt;/p&gt;

&lt;p&gt;So here is my solution.&lt;/p&gt;

&lt;div class=&quot;codebox&quot;&gt;&lt;div class=&quot;codeheader&quot;&gt;Code: &lt;span&gt;text&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;codeholder&quot;&gt;&lt;div class=&quot;text&quot; id=&quot;cb11827&quot; style=&quot;display: block; color: rgb(0, 0, 0);&quot;&gt;Public Sub New(viewlocator As IViewLocator)&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; MyBase.New(&amp;quot;/documentation&amp;quot;)&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; MyBase.Get(&amp;quot;/{Title}&amp;quot;) = Function(parameters)&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;If viewlocator.LocateView(&amp;quot;documentation/&amp;quot; &amp;amp; parameters.Title, Context) IsNot Nothing Then&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Return Negotiate.WithView(&amp;quot;documentation/&amp;quot; &amp;amp; parameters.Title)&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Else&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Return Negotiate.WithView(&amp;quot;documentation/index&amp;quot;)&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;End If&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;End Function&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div id=&quot;cb61441&quot; style=&quot;display: none; color: red;&quot;&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;With help from GrumpyDev.&lt;/p&gt;

&lt;p&gt;Quick and easy. &lt;/p&gt;

&lt;p&gt;I do not want to put to much work in the documentation since noone will ever read it anyway.&lt;/p&gt;&lt;div class=&quot;item_footer&quot;&gt;&lt;p&gt;&lt;small&gt;&lt;a href=&quot;http://blogs.lessthandot.com/index.php/WebDev/ServerProgramming/crazy-stuff-i-do-with&quot;&gt;Original post&lt;/a&gt; blogged on &lt;a href=&quot;http://lessthandot.com/&quot;&gt;LessThanDot&lt;/a&gt;.&lt;/small&gt;&lt;/p&gt;&lt;/div&gt;</description>
			<content:encoded><![CDATA[<p>No, not that.</p>

<p>I had the need to write documentation for my services. I thought having them as html would be nice and good enough. </p>

<p>So I made a bunch of vbhtml razorviews because I want my pages to be pretty and use the masterpage I already made for my main site. You know, to be consistent. </p>

<p>So I had this.</p>

<ul>
  <li>page1.vbhtml</li>
  <li>page2.vbhtml</li>
  <li>page3.vbhtml</li>
  <li>page4.vbhtml</li>
  <li>index.vbhtml</li>
</ul>

<p>And to show those pages I just have this in my module.</p>

<div class="codebox"><div class="codeheader"><span>text</span><div class="codebox_javascript_links"><a href="http://blogs.lessthandot.com" onclick="linenumberOnOff('cb3087'); return false;">Line number Off</a> | <a href="http://blogs.lessthandot.com#" onclick="expandCode('cb3087','cb92119'); return false;">Hide</a> | <a href="http://blogs.lessthandot.com#" onclick="selectCode(this); return false;">Select all</a></div></div><!-- we need this dummy div to fix a firefox bug when selecting code lines --><div class="codeholder"><div class="text" id="cb3087" style="display: block; color: rgb(0, 0, 0);"><ol><li style="" class="li1">MyBase.Get(&quot;/{Title}&quot;) = Function(parameters)</li><li style="" class="li2">&nbsp; Return Negotiate.WithView(&quot;documentation/&quot; &amp; parameters.Title)</li><li style="" class="li1">End If</li></ol></div><div id="cb92119" style="display: none; color: red;"></div></div></div>

<p>So calling page1 is as easy as </p>

<p><code class="codespan">/documentation/page1</code></p>

<p>But what if someone did</p>

<p><code class="codespan">/documentation/page12</code></p>

<p>They would get an error.</p>

<p>But, meh, I don't want that. I want them to return to the index instead. </p>

<p>So here is my solution.</p>

<div class="codebox"><div class="codeheader"><span>text</span><div class="codebox_javascript_links"><a href="http://blogs.lessthandot.com" onclick="linenumberOnOff('cb20258'); return false;">Line number Off</a> | <a href="http://blogs.lessthandot.com#" onclick="expandCode('cb20258','cb7553'); return false;">Hide</a> | <a href="http://blogs.lessthandot.com#" onclick="selectCode(this); return false;">Select all</a></div></div><!-- we need this dummy div to fix a firefox bug when selecting code lines --><div class="codeholder"><div class="text" id="cb20258" style="display: block; color: rgb(0, 0, 0);"><ol><li style="" class="li1">Public Sub New(viewlocator As IViewLocator)</li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MyBase.New(&quot;/documentation&quot;)</li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MyBase.Get(&quot;/{Title}&quot;) = Function(parameters)</li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;If viewlocator.LocateView(&quot;documentation/&quot; &amp; parameters.Title, Context) IsNot Nothing Then</li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Return Negotiate.WithView(&quot;documentation/&quot; &amp; parameters.Title)</li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Else</li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Return Negotiate.WithView(&quot;documentation/index&quot;)</li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;End If</li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;End Function</li></ol></div><div id="cb7553" style="display: none; color: red;"></div></div></div>

<p>With help from GrumpyDev.</p>

<p>Quick and easy. </p>

<p>I do not want to put to much work in the documentation since noone will ever read it anyway.</p><div class="item_footer"><p><small><a href="http://blogs.lessthandot.com/index.php/WebDev/ServerProgramming/crazy-stuff-i-do-with">Original post</a> blogged on <a href="http://lessthandot.com/">LessThanDot</a>.</small></p></div>]]></content:encoded>
								<comments>http://blogs.lessthandot.com/index.php/WebDev/ServerProgramming/crazy-stuff-i-do-with#comments</comments>
			<wfw:commentRss>http://blogs.lessthandot.com/index.php/WebDev/?tempskin=_rss2&#38;disp=comments&#38;p=2146</wfw:commentRss>
		</item>
				<item>
			<title>Nancy, IIS 7 and the PUT command</title>
			<link>http://blogs.lessthandot.com/index.php/WebDev/ServerProgramming/nancy-iis-7-and-the</link>
			<pubDate>Wed, 13 Mar 2013 06:49:00 +0000</pubDate>			<dc:creator>Christiaan Baes (chrissie1)</dc:creator>
			<category domain="main">Server Programming</category>
<category domain="alt">ASP.NET</category>			<guid isPermaLink="false">2142@http://blogs.lessthandot.com/</guid>
						<description>&lt;p&gt;When you use PUT in your Nancy application and you host your application on an IIS 7 server then you might get a 405 error (Method not allowed).&lt;/p&gt;

&lt;p&gt;The solution to this problem is very simple but I will put it here for me.&lt;/p&gt;

&lt;p&gt;The problem is that you might have the webdavmodule installed on your IIS and that is gobbling up all the PUT requests. &lt;/p&gt;

&lt;p&gt;So the simple solution is to remove the webdavmodule.&lt;/p&gt;

&lt;p&gt;You can do this via the IIS manager and just remove it from your site, but if you use webdeploy it will add it back in the next time you deploy. &lt;/p&gt;

&lt;p&gt;So it is better to use the webconfig to tell IIS you really don&#039;t want it for your particular site.&lt;/p&gt;

&lt;p&gt;So you add this to the web.config&lt;/p&gt;

&lt;div class=&quot;codebox&quot;&gt;&lt;div class=&quot;codeheader&quot;&gt;Code: &lt;span&gt;xml&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;codeholder&quot;&gt;&lt;div class=&quot;xml&quot; id=&quot;cb81490&quot; style=&quot;display: block; color: rgb(0, 0, 0);&quot;&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&lt;span style=&quot;font-weight: bold; color: black;&quot;&gt;&amp;lt;system&lt;/span&gt;.webServer&lt;span style=&quot;font-weight: bold; color: black;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #009900;&quot;&gt;&lt;span style=&quot;font-weight: bold; color: black;&quot;&gt;&amp;lt;modules&lt;span style=&quot;font-weight: bold; color: black;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #009900;&quot;&gt;&lt;span style=&quot;font-weight: bold; color: black;&quot;&gt;&amp;lt;remove&lt;/span&gt; &lt;span style=&quot;color: #000066;&quot;&gt;name&lt;/span&gt;=&lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;WebDAVModule&amp;quot;&lt;/span&gt;&lt;span style=&quot;font-weight: bold; color: black;&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #009900;&quot;&gt;&lt;span style=&quot;font-weight: bold; color: black;&quot;&gt;&amp;lt;/modules&lt;span style=&quot;font-weight: bold; color: black;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #009900;&quot;&gt;&lt;span style=&quot;font-weight: bold; color: black;&quot;&gt;&amp;lt;/system&lt;/span&gt;.webServer&lt;span style=&quot;font-weight: bold; color: black;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div id=&quot;cb61470&quot; style=&quot;display: none; color: red;&quot;&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Simple, and it works. Let&#039;s move on.&lt;/p&gt;

&lt;p&gt;No TDD was involved in the making of this blogpost.&lt;/p&gt;&lt;div class=&quot;item_footer&quot;&gt;&lt;p&gt;&lt;small&gt;&lt;a href=&quot;http://blogs.lessthandot.com/index.php/WebDev/ServerProgramming/nancy-iis-7-and-the&quot;&gt;Original post&lt;/a&gt; blogged on &lt;a href=&quot;http://lessthandot.com/&quot;&gt;LessThanDot&lt;/a&gt;.&lt;/small&gt;&lt;/p&gt;&lt;/div&gt;</description>
			<content:encoded><![CDATA[<p>When you use PUT in your Nancy application and you host your application on an IIS 7 server then you might get a 405 error (Method not allowed).</p>

<p>The solution to this problem is very simple but I will put it here for me.</p>

<p>The problem is that you might have the webdavmodule installed on your IIS and that is gobbling up all the PUT requests. </p>

<p>So the simple solution is to remove the webdavmodule.</p>

<p>You can do this via the IIS manager and just remove it from your site, but if you use webdeploy it will add it back in the next time you deploy. </p>

<p>So it is better to use the webconfig to tell IIS you really don't want it for your particular site.</p>

<p>So you add this to the web.config</p>

<div class="codebox"><div class="codeheader"><span>xml</span><div class="codebox_javascript_links"><a href="http://blogs.lessthandot.com" onclick="linenumberOnOff('cb81765'); return false;">Line number Off</a> | <a href="http://blogs.lessthandot.com#" onclick="expandCode('cb81765','cb56016'); return false;">Hide</a> | <a href="http://blogs.lessthandot.com#" onclick="selectCode(this); return false;">Select all</a></div></div><!-- we need this dummy div to fix a firefox bug when selecting code lines --><div class="codeholder"><div class="xml" id="cb81765" style="display: block; color: rgb(0, 0, 0);"><ol><li style="" class="li1"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;system</span>.webServer<span style="font-weight: bold; color: black;">&gt;</span></span></li><li style="" class="li2">&nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;modules<span style="font-weight: bold; color: black;">&gt;</span></span></span></li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;remove</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;WebDAVModule&quot;</span><span style="font-weight: bold; color: black;">/&gt;</span></span></li><li style="" class="li2">&nbsp; &nbsp; <span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/modules<span style="font-weight: bold; color: black;">&gt;</span></span></span></li><li style="" class="li1"><span style="color: #009900;"><span style="font-weight: bold; color: black;">&lt;/system</span>.webServer<span style="font-weight: bold; color: black;">&gt;</span></span></li></ol></div><div id="cb56016" style="display: none; color: red;"></div></div></div>

<p>Simple, and it works. Let's move on.</p>

<p>No TDD was involved in the making of this blogpost.</p><div class="item_footer"><p><small><a href="http://blogs.lessthandot.com/index.php/WebDev/ServerProgramming/nancy-iis-7-and-the">Original post</a> blogged on <a href="http://lessthandot.com/">LessThanDot</a>.</small></p></div>]]></content:encoded>
								<comments>http://blogs.lessthandot.com/index.php/WebDev/ServerProgramming/nancy-iis-7-and-the#comments</comments>
			<wfw:commentRss>http://blogs.lessthandot.com/index.php/WebDev/?tempskin=_rss2&#38;disp=comments&#38;p=2142</wfw:commentRss>
		</item>
				<item>
			<title>Another solution for my caching problem with servicestack.text, dapper and sql server.</title>
			<link>http://blogs.lessthandot.com/index.php/DataMgmt/DBProgramming/another-solution-for-my-caching</link>
			<pubDate>Sat, 09 Mar 2013 16:23:00 +0000</pubDate>			<dc:creator>Christiaan Baes (chrissie1)</dc:creator>
			<category domain="main">Database Programming</category>			<guid isPermaLink="false">2138@http://blogs.lessthandot.com/</guid>
						<description>&lt;h2&gt;Introduction&lt;/h2&gt;

&lt;p&gt;My problem is the speed of the datastore I am querying. I won&#039;t name the vendor but their API is horrible. If I want to get all 3000 objects of a certain type I need to first get all the Id&#039;s from the latest versions of those objects, then I have to get the properties of each of those objects, if I am unlucky those objects have subobjects and then I have to query those too. So to get 3000 objects with 2 subobjects I need to do 9001 queries. Needless to say this will be slow. &lt;/p&gt;

&lt;p&gt;Last week I had &lt;a href=&quot;http://blogs.lessthandot.com/index.php/DataMgmt/DBProgramming/redis-and-vb-net&quot;&gt;a look at redis&lt;/a&gt; to easily cache these objects on my webserver.&lt;/p&gt;

&lt;p&gt;Redis is a good solution but it is only production ready on Linux, and our ops-team was not really happy with it. Even though I got permission to set up the linux server on our ESX-servers, I was still looking at other solutions.&lt;/p&gt;

&lt;p&gt;Today I might have found such a solution. I can use SQL-server and serialize the objects as json.&lt;/p&gt;

&lt;h2&gt;The database&lt;/h2&gt;

&lt;p&gt;Not really a database since it is just one table.&lt;/p&gt;

&lt;div class=&quot;codebox&quot;&gt;&lt;div class=&quot;codeheader&quot;&gt;Code: &lt;span&gt;tsql&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;codeholder&quot;&gt;&lt;div class=&quot;tsql&quot; id=&quot;cb11178&quot; style=&quot;display: block; color: rgb(0, 0, 0);&quot;&gt;&lt;span style=&quot;color: #0000FF;&quot;&gt;CREATE&lt;/span&gt; &lt;span style=&quot;color: #0000FF;&quot;&gt;TABLE&lt;/span&gt; &lt;span style=&quot;color: #808080;&quot;&gt;&amp;#91;&lt;/span&gt;dbo&lt;span style=&quot;color: #808080;&quot;&gt;&amp;#93;&lt;/span&gt;.&lt;span style=&quot;color: #808080;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color: #00AF00;&quot;&gt;objects&lt;/span&gt;&lt;span style=&quot;color: #808080;&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span style=&quot;color: #808080;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #808080;&quot;&gt;&amp;#91;&lt;/span&gt;Id&lt;span style=&quot;color: #808080;&quot;&gt;&amp;#93;&lt;/span&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0000FF;&quot;&gt;INT&lt;/span&gt; &lt;span style=&quot;color: #0000FF;&quot;&gt;IDENTITY&lt;/span&gt; &lt;span style=&quot;color: #808080;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000;&quot;&gt;1&lt;/span&gt;, &lt;span style=&quot;color: #000;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #808080;&quot;&gt;&amp;#41;&lt;/span&gt; NOT NULL,&lt;br /&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #808080;&quot;&gt;&amp;#91;&lt;/span&gt;version&lt;span style=&quot;color: #808080;&quot;&gt;&amp;#93;&lt;/span&gt; &amp;nbsp;&lt;span style=&quot;color: #0000FF;&quot;&gt;INT&lt;/span&gt; NOT NULL,&lt;br /&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #808080;&quot;&gt;&amp;#91;&lt;/span&gt;objid&lt;span style=&quot;color: #808080;&quot;&gt;&amp;#93;&lt;/span&gt; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #0000FF;&quot;&gt;INT&lt;/span&gt; NOT NULL,&lt;br /&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #808080;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color: #0000FF;&quot;&gt;language&lt;/span&gt;&lt;span style=&quot;color: #808080;&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span style=&quot;color: #0000FF;&quot;&gt;INT&lt;/span&gt; NOT NULL,&lt;br /&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #808080;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color: #0000FF;&quot;&gt;value&lt;/span&gt;&lt;span style=&quot;color: #808080;&quot;&gt;&amp;#93;&lt;/span&gt; &amp;nbsp;&lt;span style=&quot;color: #0000FF;&quot;&gt;NVARCHAR&lt;/span&gt;&lt;span style=&quot;color: #808080;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #FF00FF;&quot;&gt;MAX&lt;/span&gt;&lt;span style=&quot;color: #808080;&quot;&gt;&amp;#41;&lt;/span&gt; NOT NULL,&lt;br /&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #808080;&quot;&gt;&amp;#91;&lt;/span&gt;objtype&lt;span style=&quot;color: #808080;&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span style=&quot;color: #0000FF;&quot;&gt;INT&lt;/span&gt; NOT NULL, &lt;br /&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0000FF;&quot;&gt;PRIMARY&lt;/span&gt; &lt;span style=&quot;color: #0000FF;&quot;&gt;KEY&lt;/span&gt; &lt;span style=&quot;color: #0000FF;&quot;&gt;CLUSTERED&lt;/span&gt; &lt;span style=&quot;color: #808080;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #808080;&quot;&gt;&amp;#91;&lt;/span&gt;Id&lt;span style=&quot;color: #808080;&quot;&gt;&amp;#93;&lt;/span&gt; &lt;span style=&quot;color: #0000FF;&quot;&gt;ASC&lt;/span&gt;&lt;span style=&quot;color: #808080;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #808080;&quot;&gt;&amp;#41;&lt;/span&gt;;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div id=&quot;cb77298&quot; style=&quot;display: none; color: red;&quot;&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Not sure how this will scale but I am pretty sure that we will not get more than 1 million rows in there any time soon. At the moment it is less than 100k rows.&lt;/p&gt;

&lt;p&gt;I can now use &lt;a href=&quot;https://code.google.com/p/dapper-dot-net/&quot;&gt;dapper &lt;/a&gt;and &lt;a href=&quot;https://github.com/ServiceStack/ServiceStack.Text&quot;&gt;servicestack.text&lt;/a&gt; to get the data in and out of there.&lt;/p&gt;

&lt;h2&gt;The code&lt;/h2&gt;

&lt;div class=&quot;codebox&quot;&gt;&lt;div class=&quot;codeheader&quot;&gt;Code: &lt;span&gt;text&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;codeholder&quot;&gt;&lt;div class=&quot;text&quot; id=&quot;cb12204&quot; style=&quot;display: block; color: rgb(0, 0, 0);&quot;&gt;Imports Dapper&lt;br /&gt;Imports System.Data.SqlClient&lt;br /&gt;Imports ServiceStack.Text&lt;br /&gt;&amp;nbsp;&lt;br /&gt;Module Module1&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp; &amp;nbsp; Sub Main()&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Dim con As New SqlConnection(&amp;quot;Server=christiaan-pc;Database=cache;Trusted_Connection=True;&amp;quot;)&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; con.Open()&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; con.Execute(&amp;quot;delete from objects&amp;quot;)&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Dim object1s = New List(Of object1)&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Dim object2s = New List(Of object2)&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Dim s As New Stopwatch&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Console.WriteLine(&amp;quot;Adding to database&amp;quot;)&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; s.Start()&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; For i = 0 To 10000&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; object1s.Add(New object1() With {.id = i, .name = &amp;quot;object1_&amp;quot; &amp;amp; i, .version = 1})&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; object2s.Add(New object2() With {.id = i, .name = &amp;quot;object2_&amp;quot; &amp;amp; i, .version = 1})&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Next&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Dim objects = New List(Of databaseobject)&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; For Each object1 In object1s&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; objects.Add(New databaseobject() With {.language = 102, .objid = object1.id, .version = object1.version, .value = object1.SerializeToString(), .objtype = 1})&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Next&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; For Each object2 In object2s&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; objects.Add(New databaseobject() With {.language = 102, .objid = object2.id, .version = object2.version, .value = object2.SerializeToString(), .objtype = 2})&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Next&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; con.Execute(&amp;quot;insert objects(objid, version, language, value, objtype) values (@objid, @version,@language,@value,@objtype)&amp;quot;,&lt;br /&gt;&amp;nbsp; &amp;nbsp; objects)&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; s.Stop()&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Console.WriteLine(s.ElapsedMilliseconds)&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Console.WriteLine(&amp;quot;Fetching from database&amp;quot;)&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; s.Restart()&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Dim l = con.Query(Of databaseobject)(&amp;quot;select objid, version, language, value, objtype from objects where objtype = 1&amp;quot;)&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Dim obj1 As object1&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; For Each m In l&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; obj1 = m.value.FromJson(Of object1)()&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Next&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; l = con.Query(Of databaseobject)(&amp;quot;select objid, version, language, value, objtype from objects where objtype = 2&amp;quot;)&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Dim obj2As object2&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; For Each m In l&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; obj2 &amp;nbsp;= m.value.FromJson(Of object2)()&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Next&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; s.Stop()&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Console.WriteLine(s.ElapsedMilliseconds)&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Console.ReadLine()&lt;br /&gt;&amp;nbsp; &amp;nbsp; End Sub&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp; &amp;nbsp; Public Class databaseobject&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Public Property id As Integer&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Public Property objid As Integer&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Public Property version As Integer&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Public Property language As Integer&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Public Property objtype As Integer&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Public Property value As String&lt;br /&gt;&amp;nbsp; &amp;nbsp; End Class&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp; &amp;nbsp; Public Class object1&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Public Property name As String&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Public Property id As Integer&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Public Property version As Integer&lt;br /&gt;&amp;nbsp; &amp;nbsp; End Class&lt;br /&gt;&amp;nbsp;&lt;br /&gt;&amp;nbsp; &amp;nbsp; Public Class object2&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Public Property name As String&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Public Property id As Integer&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Public Property version As Integer&lt;br /&gt;&amp;nbsp; &amp;nbsp; End Class&lt;br /&gt;End Module&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div id=&quot;cb51840&quot; style=&quot;display: none; color: red;&quot;&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;So I am adding 2 times 10k objects to the database and after that I rehydrate them again.&lt;/p&gt;

&lt;p&gt;On my computer this is the result.&lt;/p&gt;

&lt;blockquote&gt;&lt;p&gt;Adding to database&lt;br /&gt;
13317&lt;br /&gt;
Fetching from database&lt;br /&gt;
199&lt;/p&gt;&lt;/blockquote&gt;

&lt;p&gt;That&#039;s more then reasonable. Considering it takes 28 seconds to get 3000 objects from the datastore.&lt;/p&gt;

&lt;h2&gt;Conclusion&lt;/h2&gt;

&lt;p&gt;All though I think redis would be a good solution, I don&#039;t think it is an ideal solution for our situation.&lt;/p&gt;&lt;div class=&quot;item_footer&quot;&gt;&lt;p&gt;&lt;small&gt;&lt;a href=&quot;http://blogs.lessthandot.com/index.php/DataMgmt/DBProgramming/another-solution-for-my-caching&quot;&gt;Original post&lt;/a&gt; blogged on &lt;a href=&quot;http://lessthandot.com/&quot;&gt;LessThanDot&lt;/a&gt;.&lt;/small&gt;&lt;/p&gt;&lt;/div&gt;</description>
			<content:encoded><![CDATA[<h2>Introduction</h2>

<p>My problem is the speed of the datastore I am querying. I won't name the vendor but their API is horrible. If I want to get all 3000 objects of a certain type I need to first get all the Id's from the latest versions of those objects, then I have to get the properties of each of those objects, if I am unlucky those objects have subobjects and then I have to query those too. So to get 3000 objects with 2 subobjects I need to do 9001 queries. Needless to say this will be slow. </p>

<p>Last week I had <a href="http://blogs.lessthandot.com/index.php/DataMgmt/DBProgramming/redis-and-vb-net">a look at redis</a> to easily cache these objects on my webserver.</p>

<p>Redis is a good solution but it is only production ready on Linux, and our ops-team was not really happy with it. Even though I got permission to set up the linux server on our ESX-servers, I was still looking at other solutions.</p>

<p>Today I might have found such a solution. I can use SQL-server and serialize the objects as json.</p>

<h2>The database</h2>

<p>Not really a database since it is just one table.</p>

<div class="codebox"><div class="codeheader"><span>tsql</span><div class="codebox_javascript_links"><a href="http://blogs.lessthandot.com" onclick="linenumberOnOff('cb7942'); return false;">Line number Off</a> | <a href="http://blogs.lessthandot.com#" onclick="expandCode('cb7942','cb29038'); return false;">Hide</a> | <a href="http://blogs.lessthandot.com#" onclick="selectCode(this); return false;">Select all</a></div></div><!-- we need this dummy div to fix a firefox bug when selecting code lines --><div class="codeholder"><div class="tsql" id="cb7942" style="display: block; color: rgb(0, 0, 0);"><ol><li style="" class="li1"><span style="color: #0000FF;">CREATE</span> <span style="color: #0000FF;">TABLE</span> <span style="color: #808080;">&#91;</span>dbo<span style="color: #808080;">&#93;</span>.<span style="color: #808080;">&#91;</span><span style="color: #00AF00;">objects</span><span style="color: #808080;">&#93;</span> <span style="color: #808080;">&#40;</span></li><li style="" class="li2">&nbsp; &nbsp; <span style="color: #808080;">&#91;</span>Id<span style="color: #808080;">&#93;</span> &nbsp; &nbsp; &nbsp; <span style="color: #0000FF;">INT</span> <span style="color: #0000FF;">IDENTITY</span> <span style="color: #808080;">&#40;</span><span style="color: #000;">1</span>, <span style="color: #000;">1</span><span style="color: #808080;">&#41;</span> NOT NULL,</li><li style="" class="li1">&nbsp; &nbsp; <span style="color: #808080;">&#91;</span>version<span style="color: #808080;">&#93;</span> &nbsp;<span style="color: #0000FF;">INT</span> NOT NULL,</li><li style="" class="li2">&nbsp; &nbsp; <span style="color: #808080;">&#91;</span>objid<span style="color: #808080;">&#93;</span> &nbsp; &nbsp;<span style="color: #0000FF;">INT</span> NOT NULL,</li><li style="" class="li1">&nbsp; &nbsp; <span style="color: #808080;">&#91;</span><span style="color: #0000FF;">language</span><span style="color: #808080;">&#93;</span> <span style="color: #0000FF;">INT</span> NOT NULL,</li><li style="" class="li2">&nbsp; &nbsp; <span style="color: #808080;">&#91;</span><span style="color: #0000FF;">value</span><span style="color: #808080;">&#93;</span> &nbsp;<span style="color: #0000FF;">NVARCHAR</span><span style="color: #808080;">&#40;</span><span style="color: #FF00FF;">MAX</span><span style="color: #808080;">&#41;</span> NOT NULL,</li><li style="" class="li1">&nbsp; &nbsp; <span style="color: #808080;">&#91;</span>objtype<span style="color: #808080;">&#93;</span> <span style="color: #0000FF;">INT</span> NOT NULL, </li><li style="" class="li2">&nbsp; &nbsp; <span style="color: #0000FF;">PRIMARY</span> <span style="color: #0000FF;">KEY</span> <span style="color: #0000FF;">CLUSTERED</span> <span style="color: #808080;">&#40;</span><span style="color: #808080;">&#91;</span>Id<span style="color: #808080;">&#93;</span> <span style="color: #0000FF;">ASC</span><span style="color: #808080;">&#41;</span></li><li style="" class="li1"><span style="color: #808080;">&#41;</span>;</li></ol></div><div id="cb29038" style="display: none; color: red;"></div></div></div>

<p>Not sure how this will scale but I am pretty sure that we will not get more than 1 million rows in there any time soon. At the moment it is less than 100k rows.</p>

<p>I can now use <a href="https://code.google.com/p/dapper-dot-net/">dapper </a>and <a href="https://github.com/ServiceStack/ServiceStack.Text">servicestack.text</a> to get the data in and out of there.</p>

<h2>The code</h2>

<div class="codebox"><div class="codeheader"><span>text</span><div class="codebox_javascript_links"><a href="http://blogs.lessthandot.com" onclick="linenumberOnOff('cb89903'); return false;">Line number Off</a> | <a href="http://blogs.lessthandot.com#" onclick="expandCode('cb89903','cb71022'); return false;">Hide</a> | <a href="http://blogs.lessthandot.com#" onclick="selectCode(this); return false;">Select all</a></div></div><!-- we need this dummy div to fix a firefox bug when selecting code lines --><div class="codeholder"><div class="text" id="cb89903" style="display: block; color: rgb(0, 0, 0);"><ol><li style="" class="li1">Imports Dapper</li><li style="" class="li2">Imports System.Data.SqlClient</li><li style="" class="li1">Imports ServiceStack.Text</li><li style="" class="li2">&nbsp;</li><li style="" class="li1">Module Module1</li><li style="" class="li2">&nbsp;</li><li style="" class="li1">&nbsp; &nbsp; Sub Main()</li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; Dim con As New SqlConnection(&quot;Server=christiaan-pc;Database=cache;Trusted_Connection=True;&quot;)</li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; con.Open()</li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; con.Execute(&quot;delete from objects&quot;)</li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; Dim object1s = New List(Of object1)</li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; Dim object2s = New List(Of object2)</li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; Dim s As New Stopwatch</li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; Console.WriteLine(&quot;Adding to database&quot;)</li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; s.Start()</li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; For i = 0 To 10000</li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; object1s.Add(New object1() With {.id = i, .name = &quot;object1_&quot; &amp; i, .version = 1})</li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; object2s.Add(New object2() With {.id = i, .name = &quot;object2_&quot; &amp; i, .version = 1})</li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; Next</li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; Dim objects = New List(Of databaseobject)</li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; For Each object1 In object1s</li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; objects.Add(New databaseobject() With {.language = 102, .objid = object1.id, .version = object1.version, .value = object1.SerializeToString(), .objtype = 1})</li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; Next</li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; For Each object2 In object2s</li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; objects.Add(New databaseobject() With {.language = 102, .objid = object2.id, .version = object2.version, .value = object2.SerializeToString(), .objtype = 2})</li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; Next</li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; con.Execute(&quot;insert objects(objid, version, language, value, objtype) values (@objid, @version,@language,@value,@objtype)&quot;,</li><li style="" class="li2">&nbsp; &nbsp; objects)</li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; s.Stop()</li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; Console.WriteLine(s.ElapsedMilliseconds)</li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; Console.WriteLine(&quot;Fetching from database&quot;)</li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; s.Restart()</li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; Dim l = con.Query(Of databaseobject)(&quot;select objid, version, language, value, objtype from objects where objtype = 1&quot;)</li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; Dim obj1 As object1</li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; For Each m In l</li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; obj1 = m.value.FromJson(Of object1)()</li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; Next</li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; l = con.Query(Of databaseobject)(&quot;select objid, version, language, value, objtype from objects where objtype = 2&quot;)</li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; Dim obj2As object2</li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; For Each m In l</li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; obj2 &nbsp;= m.value.FromJson(Of object2)()</li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; Next</li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; s.Stop()</li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; Console.WriteLine(s.ElapsedMilliseconds)</li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; Console.ReadLine()</li><li style="" class="li2">&nbsp; &nbsp; End Sub</li><li style="" class="li1">&nbsp;</li><li style="" class="li2">&nbsp; &nbsp; Public Class databaseobject</li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; Public Property id As Integer</li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; Public Property objid As Integer</li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; Public Property version As Integer</li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; Public Property language As Integer</li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; Public Property objtype As Integer</li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; Public Property value As String</li><li style="" class="li1">&nbsp; &nbsp; End Class</li><li style="" class="li2">&nbsp;</li><li style="" class="li1">&nbsp; &nbsp; Public Class object1</li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; Public Property name As String</li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; Public Property id As Integer</li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; Public Property version As Integer</li><li style="" class="li1">&nbsp; &nbsp; End Class</li><li style="" class="li2">&nbsp;</li><li style="" class="li1">&nbsp; &nbsp; Public Class object2</li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; Public Property name As String</li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; Public Property id As Integer</li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; Public Property version As Integer</li><li style="" class="li1">&nbsp; &nbsp; End Class</li><li style="" class="li2">End Module</li></ol></div><div id="cb71022" style="display: none; color: red;"></div></div></div>

<p>So I am adding 2 times 10k objects to the database and after that I rehydrate them again.</p>

<p>On my computer this is the result.</p>

<blockquote><p>Adding to database<br />
13317<br />
Fetching from database<br />
199</p></blockquote>

<p>That's more then reasonable. Considering it takes 28 seconds to get 3000 objects from the datastore.</p>

<h2>Conclusion</h2>

<p>All though I think redis would be a good solution, I don't think it is an ideal solution for our situation.</p><div class="item_footer"><p><small><a href="http://blogs.lessthandot.com/index.php/DataMgmt/DBProgramming/another-solution-for-my-caching">Original post</a> blogged on <a href="http://lessthandot.com/">LessThanDot</a>.</small></p></div>]]></content:encoded>
								<comments>http://blogs.lessthandot.com/index.php/DataMgmt/DBProgramming/another-solution-for-my-caching#comments</comments>
			<wfw:commentRss>http://blogs.lessthandot.com/index.php/DataMgmt/?tempskin=_rss2&#38;disp=comments&#38;p=2138</wfw:commentRss>
		</item>
				<item>
			<title>Redis and VB.Net</title>
			<link>http://blogs.lessthandot.com/index.php/DataMgmt/DBProgramming/redis-and-vb-net</link>
			<pubDate>Sun, 03 Mar 2013 17:36:00 +0000</pubDate>			<dc:creator>Christiaan Baes (chrissie1)</dc:creator>
			<category domain="main">Database Programming</category>			<guid isPermaLink="false">2130@http://blogs.lessthandot.com/</guid>
						<description>&lt;h2&gt;Introduction&lt;/h2&gt;

&lt;p&gt;So I thought I needed redis to do some much needed caching for an app I am writting. And I was right, as I often am. &lt;/p&gt;

&lt;p&gt;So I installed &lt;a href=&quot;http://redis.io&quot;&gt;redis&lt;/a&gt; and used the &lt;a href=&quot;https://github.com/ServiceStack/ServiceStack.Redis&quot;&gt;.net redis client&lt;/a&gt; from the always brilliant Demis Bellot.&lt;/p&gt;

&lt;p&gt;Redis is a key-value database, a dictionary on steroids. It is great for caching. And it is fast at what it does by keeping most things in memory.&lt;/p&gt;

&lt;h2&gt;Redis&lt;/h2&gt;

&lt;p&gt;First I used the windows version of redis and that even worked, but it is not production ready. So I decided to install a linux VM with redis on it.&lt;/p&gt;

&lt;p&gt;I downloaded mint 14 and did apt-get install redis-server. Then you need to change the file in /etc/res/redis.conf and comment the line bind 127.0.0.1 or change it to bind 0.0.0.0. &lt;/p&gt;

&lt;p&gt;I used VMWare workstation 8 and I had to use NAT translation for the network and add forward the 6379 port.&lt;/p&gt;

&lt;div class=&quot;image_block&quot;&gt;&lt;a href=&quot;http://blogs.lessthandot.com/media/users/chrissie1/redis/redis1.png?mtime=1362333768&quot;&gt;&lt;img alt=&quot;&quot; src=&quot;http://blogs.lessthandot.com/media/users/chrissie1/redis/redis1.png?mtime=1362333768&quot; width=&quot;602&quot; height=&quot;612&quot; /&gt;&lt;/a&gt;&lt;/div&gt;

&lt;p&gt;you can check if your redis server works by doing &lt;code class=&quot;codespan&quot;&gt;redis-cli ping&lt;/code&gt; on the server. This should return PONG. To be sure the binding works you should try &lt;code class=&quot;codespan&quot;&gt;redis-cli -h ipaddress ping&lt;/code&gt;. where you change ipaddress with the ip-address of the linux machine. This should also give PONG. &lt;/p&gt;

&lt;p&gt;You can now do the same on the host to check if you can connect. &lt;/p&gt;

&lt;p&gt;If all works well you can start writing to your redis server. And we might do some reading to.&lt;/p&gt;

&lt;h2&gt;Redis-client&lt;/h2&gt;

&lt;p&gt;Here is our model.&lt;/p&gt;

&lt;div class=&quot;codebox&quot;&gt;&lt;div class=&quot;codeheader&quot;&gt;Code: &lt;span&gt;vbnet&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;codeholder&quot;&gt;&lt;div class=&quot;vbnet&quot; id=&quot;cb65232&quot; style=&quot;display: block; color: rgb(0, 0, 0);&quot;&gt;&lt;span style=&quot;color: #0600FF;&quot;&gt;Public&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;Class&lt;/span&gt; Mandate&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;Public&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;Property&lt;/span&gt; Id &lt;span style=&quot;color: #0600FF;&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;String&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;Public&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;Property&lt;/span&gt; Version &lt;span style=&quot;color: #0600FF;&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;Integer&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;Public&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;Property&lt;/span&gt; Name &lt;span style=&quot;color: #0600FF;&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;String&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;End&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;Class&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div id=&quot;cb24836&quot; style=&quot;display: none; color: red;&quot;&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Firstly you need to nuget servicestack.redis.&lt;/p&gt;

&lt;p&gt;The following code writes some entries to our redis server.&lt;/p&gt;

&lt;div class=&quot;codebox&quot;&gt;&lt;div class=&quot;codeheader&quot;&gt;Code: &lt;span&gt;vbnet&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;codeholder&quot;&gt;&lt;div class=&quot;vbnet&quot; id=&quot;cb42861&quot; style=&quot;display: block; color: rgb(0, 0, 0);&quot;&gt;Using redisClient = &lt;span style=&quot;color: #0600FF;&quot;&gt;New&lt;/span&gt; RedisClient&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;ipaddressofthelinuxvm&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;Dim&lt;/span&gt; client = redisClient.&lt;span style=&quot;color: #0600FF;&quot;&gt;As&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;Of Mandate&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; client.&lt;span style=&quot;color: #000000;&quot;&gt;GetAllKeys&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;.&lt;span style=&quot;color: #000000;&quot;&gt;Count&lt;/span&gt;.&lt;span style=&quot;color: #000000;&quot;&gt;PrintDump&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;For&lt;/span&gt; i &lt;span style=&quot;color: #0600FF;&quot;&gt;As&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;Integer&lt;/span&gt; = &lt;span style=&quot;color: #FF0000;&quot;&gt;1&lt;/span&gt; &lt;span style=&quot;color: #0600FF;&quot;&gt;To&lt;/span&gt; &lt;span style=&quot;color: #FF0000;&quot;&gt;500&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; client.&lt;span style=&quot;color: #000000;&quot;&gt;SetEntry&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;i, &lt;span style=&quot;color: #0600FF;&quot;&gt;New&lt;/span&gt; Mandate&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt; With &lt;span style=&quot;color: #000000;&quot;&gt;&amp;#123;&lt;/span&gt;.&lt;span style=&quot;color: #000000;&quot;&gt;Id&lt;/span&gt; = i, .&lt;span style=&quot;color: #000000;&quot;&gt;Version&lt;/span&gt; = &lt;span style=&quot;color: #FF0000;&quot;&gt;1&lt;/span&gt;, .&lt;span style=&quot;color: #000000;&quot;&gt;Name&lt;/span&gt; = &lt;span style=&quot;color: #0600FF;&quot;&gt;&amp;quot;Name&amp;quot;&lt;/span&gt; &amp;amp; i&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;Next&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;Dim&lt;/span&gt; mandate5 = client.&lt;span style=&quot;color: #000000;&quot;&gt;GetValue&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #FF0000;&quot;&gt;5&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; mandate5.&lt;span style=&quot;color: #000000;&quot;&gt;Version&lt;/span&gt; += &lt;span style=&quot;color: #FF0000;&quot;&gt;1&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; client.&lt;span style=&quot;color: #000000;&quot;&gt;SetEntry&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #FF0000;&quot;&gt;5&lt;/span&gt;, mandate5&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; client.&lt;span style=&quot;color: #000000;&quot;&gt;GetValue&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #FF0000;&quot;&gt;5&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;.&lt;span style=&quot;color: #000000;&quot;&gt;PrintDump&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; client.&lt;span style=&quot;color: #000000;&quot;&gt;GetAllKeys&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;.&lt;span style=&quot;color: #000000;&quot;&gt;Where&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0600FF;&quot;&gt;Function&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;x&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt; Not x.&lt;span style=&quot;color: #000000;&quot;&gt;Contains&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #0600FF;&quot;&gt;&amp;quot;ids&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;.&lt;span style=&quot;color: #000000;&quot;&gt;Count&lt;/span&gt;.&lt;span style=&quot;color: #000000;&quot;&gt;PrintDump&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; client.&lt;span style=&quot;color: #000000;&quot;&gt;Save&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;span style=&quot;color: #0600FF;&quot;&gt;End&lt;/span&gt; Using&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Console.&lt;span style=&quot;color: #000000;&quot;&gt;ReadLine&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #000000;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div id=&quot;cb92310&quot; style=&quot;display: none; color: red;&quot;&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;If you run the above you will get.&lt;/p&gt;

&lt;blockquote&gt;&lt;p&gt;0&lt;br /&gt;
{&lt;br /&gt;
        Id: 5,&lt;br /&gt;
        Version: 2,&lt;br /&gt;
        Name: Name5&lt;br /&gt;
}&lt;br /&gt;
500&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;On a second run you will get.&lt;/p&gt;

&lt;blockquote&gt;&lt;p&gt;501&lt;br /&gt;
{&lt;br /&gt;
        Id: 5,&lt;br /&gt;
        Version: 2,&lt;br /&gt;
        Name: Name5&lt;br /&gt;
}&lt;br /&gt;
500&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;So I add 500 objects but it tells me I have 501. The 501st is the id of the mandate class.&lt;/p&gt;

&lt;p&gt;I don&#039;t really need to do the save, since redis will do an autosave every so often (depends on your redis.conf).&lt;/p&gt;

&lt;h2&gt;Conclusion&lt;/h2&gt;

&lt;p&gt;It is here that I pretend that redis is easy to use and to set up. And it is, just not for me ;-).&lt;/p&gt;

&lt;p&gt;I would like to thank Demis for setting me on the way to solving my connectivity problems with the VM. &lt;/p&gt;



&lt;p&gt;The second time it won&#039;t add another 500 entries, it will update the ones that are there.&lt;/p&gt;&lt;div class=&quot;item_footer&quot;&gt;&lt;p&gt;&lt;small&gt;&lt;a href=&quot;http://blogs.lessthandot.com/index.php/DataMgmt/DBProgramming/redis-and-vb-net&quot;&gt;Original post&lt;/a&gt; blogged on &lt;a href=&quot;http://lessthandot.com/&quot;&gt;LessThanDot&lt;/a&gt;.&lt;/small&gt;&lt;/p&gt;&lt;/div&gt;</description>
			<content:encoded><![CDATA[<h2>Introduction</h2>

<p>So I thought I needed redis to do some much needed caching for an app I am writting. And I was right, as I often am. </p>

<p>So I installed <a href="http://redis.io">redis</a> and used the <a href="https://github.com/ServiceStack/ServiceStack.Redis">.net redis client</a> from the always brilliant Demis Bellot.</p>

<p>Redis is a key-value database, a dictionary on steroids. It is great for caching. And it is fast at what it does by keeping most things in memory.</p>

<h2>Redis</h2>

<p>First I used the windows version of redis and that even worked, but it is not production ready. So I decided to install a linux VM with redis on it.</p>

<p>I downloaded mint 14 and did apt-get install redis-server. Then you need to change the file in /etc/res/redis.conf and comment the line bind 127.0.0.1 or change it to bind 0.0.0.0. </p>

<p>I used VMWare workstation 8 and I had to use NAT translation for the network and add forward the 6379 port.</p>

<div class="image_block"><a href="http://blogs.lessthandot.com/media/users/chrissie1/redis/redis1.png?mtime=1362333768"><img alt="" src="http://blogs.lessthandot.com/media/users/chrissie1/redis/redis1.png?mtime=1362333768" width="602" height="612" /></a></div>

<p>you can check if your redis server works by doing <code class="codespan">redis-cli ping</code> on the server. This should return PONG. To be sure the binding works you should try <code class="codespan">redis-cli -h ipaddress ping</code>. where you change ipaddress with the ip-address of the linux machine. This should also give PONG. </p>

<p>You can now do the same on the host to check if you can connect. </p>

<p>If all works well you can start writing to your redis server. And we might do some reading to.</p>

<h2>Redis-client</h2>

<p>Here is our model.</p>

<div class="codebox"><div class="codeheader"><span>vbnet</span><div class="codebox_javascript_links"><a href="http://blogs.lessthandot.com" onclick="linenumberOnOff('cb58432'); return false;">Line number Off</a> | <a href="http://blogs.lessthandot.com#" onclick="expandCode('cb58432','cb76346'); return false;">Hide</a> | <a href="http://blogs.lessthandot.com#" onclick="selectCode(this); return false;">Select all</a></div></div><!-- we need this dummy div to fix a firefox bug when selecting code lines --><div class="codeholder"><div class="vbnet" id="cb58432" style="display: block; color: rgb(0, 0, 0);"><ol><li style="" class="li1"><span style="color: #0600FF;">Public</span> <span style="color: #0600FF;">Class</span> Mandate</li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Public</span> <span style="color: #0600FF;">Property</span> Id <span style="color: #0600FF;">As</span> <span style="color: #0600FF;">String</span></li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Public</span> <span style="color: #0600FF;">Property</span> Version <span style="color: #0600FF;">As</span> <span style="color: #0600FF;">Integer</span></li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Public</span> <span style="color: #0600FF;">Property</span> Name <span style="color: #0600FF;">As</span> <span style="color: #0600FF;">String</span></li><li style="" class="li1">&nbsp; &nbsp; <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Class</span></li></ol></div><div id="cb76346" style="display: none; color: red;"></div></div></div>

<p>Firstly you need to nuget servicestack.redis.</p>

<p>The following code writes some entries to our redis server.</p>

<div class="codebox"><div class="codeheader"><span>vbnet</span><div class="codebox_javascript_links"><a href="http://blogs.lessthandot.com" onclick="linenumberOnOff('cb90758'); return false;">Line number Off</a> | <a href="http://blogs.lessthandot.com#" onclick="expandCode('cb90758','cb60598'); return false;">Hide</a> | <a href="http://blogs.lessthandot.com#" onclick="selectCode(this); return false;">Select all</a></div></div><!-- we need this dummy div to fix a firefox bug when selecting code lines --><div class="codeholder"><div class="vbnet" id="cb90758" style="display: block; color: rgb(0, 0, 0);"><ol><li style="" class="li1">Using redisClient = <span style="color: #0600FF;">New</span> RedisClient<span style="color: #000000;">&#40;</span>ipaddressofthelinuxvm<span style="color: #000000;">&#41;</span></li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Dim</span> client = redisClient.<span style="color: #0600FF;">As</span><span style="color: #000000;">&#40;</span>Of Mandate<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span></li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; client.<span style="color: #000000;">GetAllKeys</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>.<span style="color: #000000;">Count</span>.<span style="color: #000000;">PrintDump</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span></li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">For</span> i <span style="color: #0600FF;">As</span> <span style="color: #0600FF;">Integer</span> = <span style="color: #FF0000;">1</span> <span style="color: #0600FF;">To</span> <span style="color: #FF0000;">500</span></li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; client.<span style="color: #000000;">SetEntry</span><span style="color: #000000;">&#40;</span>i, <span style="color: #0600FF;">New</span> Mandate<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> With <span style="color: #000000;">&#123;</span>.<span style="color: #000000;">Id</span> = i, .<span style="color: #000000;">Version</span> = <span style="color: #FF0000;">1</span>, .<span style="color: #000000;">Name</span> = <span style="color: #0600FF;">&quot;Name&quot;</span> &amp; i<span style="color: #000000;">&#125;</span><span style="color: #000000;">&#41;</span></li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Next</span></li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">Dim</span> mandate5 = client.<span style="color: #000000;">GetValue</span><span style="color: #000000;">&#40;</span><span style="color: #FF0000;">5</span><span style="color: #000000;">&#41;</span></li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mandate5.<span style="color: #000000;">Version</span> += <span style="color: #FF0000;">1</span></li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; client.<span style="color: #000000;">SetEntry</span><span style="color: #000000;">&#40;</span><span style="color: #FF0000;">5</span>, mandate5<span style="color: #000000;">&#41;</span></li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; client.<span style="color: #000000;">GetValue</span><span style="color: #000000;">&#40;</span><span style="color: #FF0000;">5</span><span style="color: #000000;">&#41;</span>.<span style="color: #000000;">PrintDump</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span></li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; client.<span style="color: #000000;">GetAllKeys</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>.<span style="color: #000000;">Where</span><span style="color: #000000;">&#40;</span><span style="color: #0600FF;">Function</span><span style="color: #000000;">&#40;</span>x<span style="color: #000000;">&#41;</span> Not x.<span style="color: #000000;">Contains</span><span style="color: #000000;">&#40;</span><span style="color: #0600FF;">&quot;ids&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>.<span style="color: #000000;">Count</span>.<span style="color: #000000;">PrintDump</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span></li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; client.<span style="color: #000000;">Save</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span></li><li style="" class="li1">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">End</span> Using</li><li style="" class="li2">&nbsp; &nbsp; &nbsp; &nbsp; Console.<span style="color: #000000;">ReadLine</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span></li></ol></div><div id="cb60598" style="display: none; color: red;"></div></div></div>

<p>If you run the above you will get.</p>

<blockquote><p>0<br />
{<br />
        Id: 5,<br />
        Version: 2,<br />
        Name: Name5<br />
}<br />
500</p>
</blockquote>

<p>On a second run you will get.</p>

<blockquote><p>501<br />
{<br />
        Id: 5,<br />
        Version: 2,<br />
        Name: Name5<br />
}<br />
500</p>
</blockquote>

<p>So I add 500 objects but it tells me I have 501. The 501st is the id of the mandate class.</p>

<p>I don't really need to do the save, since redis will do an autosave every so often (depends on your redis.conf).</p>

<h2>Conclusion</h2>

<p>It is here that I pretend that redis is easy to use and to set up. And it is, just not for me ;-).</p>

<p>I would like to thank Demis for setting me on the way to solving my connectivity problems with the VM. </p>



<p>The second time it won't add another 500 entries, it will update the ones that are there.</p><div class="item_footer"><p><small><a href="http://blogs.lessthandot.com/index.php/DataMgmt/DBProgramming/redis-and-vb-net">Original post</a> blogged on <a href="http://lessthandot.com/">LessThanDot</a>.</small></p></div>]]></content:encoded>
								<comments>http://blogs.lessthandot.com/index.php/DataMgmt/DBProgramming/redis-and-vb-net#comments</comments>
			<wfw:commentRss>http://blogs.lessthandot.com/index.php/DataMgmt/?tempskin=_rss2&#38;disp=comments&#38;p=2130</wfw:commentRss>
		</item>
				<item>
			<title>All new ChocolateyGUI</title>
			<link>http://blogs.lessthandot.com/index.php/SysAdmins/OS/Windows/all-new-chocolateygui</link>
			<pubDate>Sat, 09 Feb 2013 14:55:00 +0000</pubDate>			<dc:creator>Christiaan Baes (chrissie1)</dc:creator>
			<category domain="main">Windows</category>
<category domain="alt">Windows 7</category>
<category domain="alt">Windows 8</category>			<guid isPermaLink="false">2091@http://blogs.lessthandot.com/</guid>
						<description>&lt;h2&gt;Introduction&lt;/h2&gt;

&lt;p&gt;I admit I had been neglecting ChocolateyGUI for the last year or so. And it was no longer compatible with the current version of Chocolatey.&lt;/p&gt;

&lt;p&gt;But a few weeks ago a gentle soul called &lt;a href=&quot;https://twitter.com/miracula_de&quot;&gt;Miracula&lt;/a&gt; decided it was time to help and I made her a contributor the moment she did. After all it was my very first pull request ever and I was happy. &lt;/p&gt;

&lt;p&gt;This weekend I decided to give ChocolateyGUI some more of my love and attention. And noticed that Miracula had been very busy indeed. &lt;/p&gt;

&lt;p&gt;So I decided that it was time for a &lt;a href=&quot;http://chocolatey.org/packages/ChocolateyGUI&quot;&gt;new package&lt;/a&gt;. &lt;/p&gt;

&lt;p&gt;And here it is.&lt;/p&gt;

&lt;h2&gt;Installation&lt;/h2&gt;

&lt;p&gt;Installation is very simple.&lt;/p&gt;

&lt;div class=&quot;codebox&quot;&gt;&lt;div class=&quot;codeheader&quot;&gt;Code: &lt;span&gt;text&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;codeholder&quot;&gt;&lt;div class=&quot;text&quot; id=&quot;cb29797&quot; style=&quot;display: block; color: rgb(0, 0, 0);&quot;&gt;cinst ChocolateyGUI&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div id=&quot;cb22658&quot; style=&quot;display: none; color: red;&quot;&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;p&gt; &lt;/p&gt;

&lt;p&gt;That&#039;s it. As long as you have Chocolatey installed of course. But even that is &lt;a href=&quot;http://chocolatey.org/&quot;&gt;easy to install&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;New features&lt;/h2&gt;

&lt;p&gt;Just look how pretty it is.&lt;/p&gt;

&lt;div class=&quot;image_block&quot;&gt;&lt;a href=&quot;http://blogs.lessthandot.com/media/users/chrissie1/chocolatey/ChocoGUI1.png?mtime=1360428609&quot;&gt;&lt;img alt=&quot;&quot; src=&quot;http://blogs.lessthandot.com/media/users/chrissie1/chocolatey/ChocoGUI1.png?mtime=1360428609&quot; width=&quot;1037&quot; height=&quot;534&quot; /&gt;&lt;/a&gt;&lt;/div&gt;

&lt;p&gt;You can search in the list. It is a StartsWith list.&lt;br /&gt;
You can install the available package by clicking on the checkbox.&lt;br /&gt;
You can uninstall a package.&lt;br /&gt;
You can update chocolatey, because it will be in the list of installed packages.&lt;br /&gt;
It is a lot faster.&lt;br /&gt;
It shows a lot more information about the selected package.&lt;/p&gt;

&lt;h2&gt;Open source&lt;/h2&gt;

&lt;p&gt;And the code is still &lt;a href=&quot;https://github.com/chrissie1/chocolatey-Explorer&quot;&gt;open source&lt;/a&gt;. And we accept pull-requests and feature requests.&lt;/p&gt;

&lt;h2&gt;Conclusion&lt;/h2&gt;

&lt;p&gt;I want to thank Miracula again for the awesome work she did.&lt;/p&gt;

&lt;p&gt;&lt;span class=&quot;MT_red&quot;&gt;Update&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;ChocolateyGUI has a dependecy on powershell 3.0. You can install that by doing cinst powershell. In the next version we wil install this as a dependency package.&lt;/p&gt;&lt;div class=&quot;item_footer&quot;&gt;&lt;p&gt;&lt;small&gt;&lt;a href=&quot;http://blogs.lessthandot.com/index.php/SysAdmins/OS/Windows/all-new-chocolateygui&quot;&gt;Original post&lt;/a&gt; blogged on &lt;a href=&quot;http://lessthandot.com/&quot;&gt;LessThanDot&lt;/a&gt;.&lt;/small&gt;&lt;/p&gt;&lt;/div&gt;</description>
			<content:encoded><![CDATA[<h2>Introduction</h2>

<p>I admit I had been neglecting ChocolateyGUI for the last year or so. And it was no longer compatible with the current version of Chocolatey.</p>

<p>But a few weeks ago a gentle soul called <a href="https://twitter.com/miracula_de">Miracula</a> decided it was time to help and I made her a contributor the moment she did. After all it was my very first pull request ever and I was happy. </p>

<p>This weekend I decided to give ChocolateyGUI some more of my love and attention. And noticed that Miracula had been very busy indeed. </p>

<p>So I decided that it was time for a <a href="http://chocolatey.org/packages/ChocolateyGUI">new package</a>. </p>

<p>And here it is.</p>

<h2>Installation</h2>

<p>Installation is very simple.</p>

<div class="codebox"><div class="codeheader"><span>text</span><div class="codebox_javascript_links"><a href="http://blogs.lessthandot.com" onclick="linenumberOnOff('cb10152'); return false;">Line number Off</a> | <a href="http://blogs.lessthandot.com#" onclick="expandCode('cb10152','cb88075'); return false;">Hide</a> | <a href="http://blogs.lessthandot.com#" onclick="selectCode(this); return false;">Select all</a></div></div><!-- we need this dummy div to fix a firefox bug when selecting code lines --><div class="codeholder"><div class="text" id="cb10152" style="display: block; color: rgb(0, 0, 0);"><ol><li style="" class="li1">cinst ChocolateyGUI</li></ol></div><div id="cb88075" style="display: none; color: red;"></div></div></div><p> </p>

<p>That's it. As long as you have Chocolatey installed of course. But even that is <a href="http://chocolatey.org/">easy to install</a>.</p>

<h2>New features</h2>

<p>Just look how pretty it is.</p>

<div class="image_block"><a href="http://blogs.lessthandot.com/media/users/chrissie1/chocolatey/ChocoGUI1.png?mtime=1360428609"><img alt="" src="http://blogs.lessthandot.com/media/users/chrissie1/chocolatey/ChocoGUI1.png?mtime=1360428609" width="1037" height="534" /></a></div>

<p>You can search in the list. It is a StartsWith list.<br />
You can install the available package by clicking on the checkbox.<br />
You can uninstall a package.<br />
You can update chocolatey, because it will be in the list of installed packages.<br />
It is a lot faster.<br />
It shows a lot more information about the selected package.</p>

<h2>Open source</h2>

<p>And the code is still <a href="https://github.com/chrissie1/chocolatey-Explorer">open source</a>. And we accept pull-requests and feature requests.</p>

<h2>Conclusion</h2>

<p>I want to thank Miracula again for the awesome work she did.</p>

<p><span class="MT_red">Update</span></p>

<p>ChocolateyGUI has a dependecy on powershell 3.0. You can install that by doing cinst powershell. In the next version we wil install this as a dependency package.</p><div class="item_footer"><p><small><a href="http://blogs.lessthandot.com/index.php/SysAdmins/OS/Windows/all-new-chocolateygui">Original post</a> blogged on <a href="http://lessthandot.com/">LessThanDot</a>.</small></p></div>]]></content:encoded>
								<comments>http://blogs.lessthandot.com/index.php/SysAdmins/OS/Windows/all-new-chocolateygui#comments</comments>
			<wfw:commentRss>http://blogs.lessthandot.com/index.php/SysAdmins/?tempskin=_rss2&#38;disp=comments&#38;p=2091</wfw:commentRss>
		</item>
				<item>
			<title>Making your own Local root CA and using it as an SSL certificate for intranet websites.</title>
			<link>http://blogs.lessthandot.com/index.php/SysAdmins/OS/Windows/2008Server/making-your-own-local-root</link>
			<pubDate>Wed, 06 Feb 2013 11:11:00 +0000</pubDate>			<dc:creator>Christiaan Baes (chrissie1)</dc:creator>
			<category domain="alt">Windows</category>
<category domain="main">2008 Server</category>			<guid isPermaLink="false">2082@http://blogs.lessthandot.com/</guid>
						<description>&lt;h2&gt;Introduction&lt;/h2&gt;

&lt;p&gt;I had my intranet site selfsigned before. But the problem with self signing is that the user gets a warning.&lt;/p&gt;

&lt;div class=&quot;image_block&quot;&gt;&lt;a href=&quot;http://blogs.lessthandot.com/media/blogs/SysAdmins/certificate/certificate1.png?mtime=1360153997&quot;&gt;&lt;img alt=&quot;&quot; src=&quot;http://blogs.lessthandot.com/media/blogs/SysAdmins/certificate/certificate1.png?mtime=1360153997&quot; width=&quot;714&quot; height=&quot;344&quot; /&gt;&lt;/a&gt;&lt;/div&gt;

&lt;p&gt;And of course we all click continue and then you get this. &lt;br /&gt;
Which makes the addressbar totally useless because gray on pink is not very readable.&lt;/p&gt;

&lt;div class=&quot;image_block&quot;&gt;&lt;a href=&quot;http://blogs.lessthandot.com/media/blogs/SysAdmins/certificate/certificate2.png?mtime=1360154006&quot;&gt;&lt;img alt=&quot;&quot; src=&quot;http://blogs.lessthandot.com/media/blogs/SysAdmins/certificate/certificate2.png?mtime=1360154006&quot; width=&quot;587&quot; height=&quot;47&quot; /&gt;&lt;/a&gt;&lt;/div&gt;

&lt;p&gt;So I set out to fix it. And here is my story.&lt;/p&gt;

&lt;h2&gt;Installation&lt;/h2&gt;

&lt;p&gt;You should install the Active directory certificate services. Go to &lt;a href=&quot;http://technet.microsoft.com/en-us/library/cc947821(v=ws.10).aspx&quot;&gt;technet to learn&lt;/a&gt; how to do that for your server, I did.&lt;br /&gt;
This should apparently be installed on your domain controller. And yes I tried on a member server and no that was no success, so just listen to me.&lt;/p&gt;

&lt;h2&gt;IIS&lt;/h2&gt;

&lt;p&gt;Now go to you IIS manager and click on your server and find the option Server certificates.&lt;/p&gt;

&lt;div class=&quot;image_block&quot;&gt;&lt;a href=&quot;http://blogs.lessthandot.com/media/blogs/SysAdmins/certificate/certificate3.png?mtime=1360154614&quot;&gt;&lt;img alt=&quot;&quot; src=&quot;http://blogs.lessthandot.com/media/blogs/SysAdmins/certificate/certificate3.png?mtime=1360154614&quot; width=&quot;599&quot; height=&quot;238&quot; /&gt;&lt;/a&gt;&lt;/div&gt;

&lt;p&gt;Then in the Actions menu select Create Domain certificate.&lt;/p&gt;

&lt;div class=&quot;image_block&quot;&gt;&lt;a href=&quot;http://blogs.lessthandot.com/media/blogs/SysAdmins/certificate/certificate4.png?mtime=1360154727&quot;&gt;&lt;img alt=&quot;&quot; src=&quot;http://blogs.lessthandot.com/media/blogs/SysAdmins/certificate/certificate4.png?mtime=1360154727&quot; width=&quot;234&quot; height=&quot;233&quot; /&gt;&lt;/a&gt;&lt;/div&gt;

&lt;p&gt;You will then see this.&lt;/p&gt;

&lt;div class=&quot;image_block&quot;&gt;&lt;a href=&quot;http://blogs.lessthandot.com/media/blogs/SysAdmins/certificate/certificate5.png?mtime=1360154849&quot;&gt;&lt;img alt=&quot;&quot; src=&quot;http://blogs.lessthandot.com/media/blogs/SysAdmins/certificate/certificate5.png?mtime=1360154849&quot; width=&quot;580&quot; height=&quot;444&quot; /&gt;&lt;/a&gt;&lt;/div&gt;

&lt;p&gt;Be careful to fill in the correct common name, the common name should be the domain name of your website. The part that comes after the https:// part and before the next /.&lt;/p&gt;

&lt;p&gt;Then next.&lt;/p&gt;

&lt;div class=&quot;image_block&quot;&gt;&lt;a href=&quot;http://blogs.lessthandot.com/media/blogs/SysAdmins/certificate/certificate6.png?mtime=1360154965&quot;&gt;&lt;img alt=&quot;&quot; src=&quot;http://blogs.lessthandot.com/media/blogs/SysAdmins/certificate/certificate6.png?mtime=1360154965&quot; width=&quot;581&quot; height=&quot;445&quot; /&gt;&lt;/a&gt;&lt;/div&gt;

&lt;p&gt;Then pick your authority service, if all went well that should be the one you installed on your domain controller.&lt;br /&gt;
And give it a friendly name.&lt;/p&gt;

&lt;p&gt;Now go to your site and click on Bindings in the Actions thing.&lt;/p&gt;

&lt;div class=&quot;image_block&quot;&gt;&lt;a href=&quot;http://blogs.lessthandot.com/media/blogs/SysAdmins/certificate/certificate7.png?mtime=1360155190&quot;&gt;&lt;img alt=&quot;&quot; src=&quot;http://blogs.lessthandot.com/media/blogs/SysAdmins/certificate/certificate7.png?mtime=1360155190&quot; width=&quot;226&quot; height=&quot;193&quot; /&gt;&lt;/a&gt;&lt;/div&gt;

&lt;p&gt;Select https as the type and set the port and select your certificate by its friendly name.&lt;/p&gt;

&lt;div class=&quot;image_block&quot;&gt;&lt;a href=&quot;http://blogs.lessthandot.com/media/blogs/SysAdmins/certificate/certificate8.png?mtime=1360155319&quot;&gt;&lt;img alt=&quot;&quot; src=&quot;http://blogs.lessthandot.com/media/blogs/SysAdmins/certificate/certificate8.png?mtime=1360155319&quot; width=&quot;490&quot; height=&quot;226&quot; /&gt;&lt;/a&gt;&lt;/div&gt;

&lt;h2&gt;The clients&lt;/h2&gt;

&lt;p&gt;Now it&#039;s time to configure our clients. &lt;/p&gt;

&lt;p&gt;Since we are on a domain controller we can use a group policy for that.&lt;/p&gt;

&lt;p&gt;First we need to get the certificate.&lt;/p&gt;

&lt;p&gt;Now open MMC on your webserver and add certificates for your computer account on your local machine. &lt;/p&gt;

&lt;p&gt;Then go to personal and certificates. Right-click on your certificate and select export.&lt;/p&gt;

&lt;div class=&quot;image_block&quot;&gt;&lt;a href=&quot;http://blogs.lessthandot.com/media/blogs/SysAdmins/certificate/certificate9.png?mtime=1360155468&quot;&gt;&lt;img alt=&quot;&quot; src=&quot;http://blogs.lessthandot.com/media/blogs/SysAdmins/certificate/certificate9.png?mtime=1360155468&quot; width=&quot;825&quot; height=&quot;215&quot; /&gt;&lt;/a&gt;&lt;/div&gt;

&lt;p&gt;Remeber where you parked it and copy it to your domain controller.&lt;/p&gt;

&lt;p&gt;Now open the Group policy manager.&lt;/p&gt;

&lt;p&gt;Click on your Default Domain Policy.&lt;/p&gt;

&lt;p&gt;Go to Computer configuration -&gt; Policies -&gt; Windows settings -&gt; Security settings -&gt; Public key policies -&gt; Trusted Root Certification Authorities -&gt; Take a deep breath.&lt;/p&gt;

&lt;p&gt;Now right click that and select import.&lt;/p&gt;

&lt;div class=&quot;image_block&quot;&gt;&lt;a href=&quot;http://blogs.lessthandot.com/media/blogs/SysAdmins/certificate/certificate10.png?mtime=1360156026&quot;&gt;&lt;img alt=&quot;&quot; src=&quot;http://blogs.lessthandot.com/media/blogs/SysAdmins/certificate/certificate10.png?mtime=1360156026&quot; width=&quot;396&quot; height=&quot;412&quot; /&gt;&lt;/a&gt;&lt;/div&gt;

&lt;p&gt;Select your certificate that you exported a while ago and wait for the clients to replicate.&lt;/p&gt;

&lt;p&gt;Done.&lt;/p&gt;

&lt;p&gt;Now you get this.&lt;/p&gt;

&lt;div class=&quot;image_block&quot;&gt;&lt;a href=&quot;http://blogs.lessthandot.com/media/blogs/SysAdmins/certificate/certificate11.png?mtime=1360156204&quot;&gt;&lt;img alt=&quot;&quot; src=&quot;http://blogs.lessthandot.com/media/blogs/SysAdmins/certificate/certificate11.png?mtime=1360156204&quot; width=&quot;573&quot; height=&quot;246&quot; /&gt;&lt;/a&gt;&lt;/div&gt;

&lt;p&gt;No, it&#039;s not fully trusted but it no longer gives a warning either.&lt;/p&gt;

&lt;p&gt;And Chris is happy.&lt;/p&gt;

&lt;h2&gt;Conclusion&lt;/h2&gt;

&lt;p&gt;This is here for my own reference.&lt;/p&gt;&lt;div class=&quot;item_footer&quot;&gt;&lt;p&gt;&lt;small&gt;&lt;a href=&quot;http://blogs.lessthandot.com/index.php/SysAdmins/OS/Windows/2008Server/making-your-own-local-root&quot;&gt;Original post&lt;/a&gt; blogged on &lt;a href=&quot;http://lessthandot.com/&quot;&gt;LessThanDot&lt;/a&gt;.&lt;/small&gt;&lt;/p&gt;&lt;/div&gt;</description>
			<content:encoded><![CDATA[<h2>Introduction</h2>

<p>I had my intranet site selfsigned before. But the problem with self signing is that the user gets a warning.</p>

<div class="image_block"><a href="http://blogs.lessthandot.com/media/blogs/SysAdmins/certificate/certificate1.png?mtime=1360153997"><img alt="" src="http://blogs.lessthandot.com/media/blogs/SysAdmins/certificate/certificate1.png?mtime=1360153997" width="714" height="344" /></a></div>

<p>And of course we all click continue and then you get this. <br />
Which makes the addressbar totally useless because gray on pink is not very readable.</p>

<div class="image_block"><a href="http://blogs.lessthandot.com/media/blogs/SysAdmins/certificate/certificate2.png?mtime=1360154006"><img alt="" src="http://blogs.lessthandot.com/media/blogs/SysAdmins/certificate/certificate2.png?mtime=1360154006" width="587" height="47" /></a></div>

<p>So I set out to fix it. And here is my story.</p>

<h2>Installation</h2>

<p>You should install the Active directory certificate services. Go to <a href="http://technet.microsoft.com/en-us/library/cc947821(v=ws.10).aspx">technet to learn</a> how to do that for your server, I did.<br />
This should apparently be installed on your domain controller. And yes I tried on a member server and no that was no success, so just listen to me.</p>

<h2>IIS</h2>

<p>Now go to you IIS manager and click on your server and find the option Server certificates.</p>

<div class="image_block"><a href="http://blogs.lessthandot.com/media/blogs/SysAdmins/certificate/certificate3.png?mtime=1360154614"><img alt="" src="http://blogs.lessthandot.com/media/blogs/SysAdmins/certificate/certificate3.png?mtime=1360154614" width="599" height="238" /></a></div>

<p>Then in the Actions menu select Create Domain certificate.</p>

<div class="image_block"><a href="http://blogs.lessthandot.com/media/blogs/SysAdmins/certificate/certificate4.png?mtime=1360154727"><img alt="" src="http://blogs.lessthandot.com/media/blogs/SysAdmins/certificate/certificate4.png?mtime=1360154727" width="234" height="233" /></a></div>

<p>You will then see this.</p>

<div class="image_block"><a href="http://blogs.lessthandot.com/media/blogs/SysAdmins/certificate/certificate5.png?mtime=1360154849"><img alt="" src="http://blogs.lessthandot.com/media/blogs/SysAdmins/certificate/certificate5.png?mtime=1360154849" width="580" height="444" /></a></div>

<p>Be careful to fill in the correct common name, the common name should be the domain name of your website. The part that comes after the https:// part and before the next /.</p>

<p>Then next.</p>

<div class="image_block"><a href="http://blogs.lessthandot.com/media/blogs/SysAdmins/certificate/certificate6.png?mtime=1360154965"><img alt="" src="http://blogs.lessthandot.com/media/blogs/SysAdmins/certificate/certificate6.png?mtime=1360154965" width="581" height="445" /></a></div>

<p>Then pick your authority service, if all went well that should be the one you installed on your domain controller.<br />
And give it a friendly name.</p>

<p>Now go to your site and click on Bindings in the Actions thing.</p>

<div class="image_block"><a href="http://blogs.lessthandot.com/media/blogs/SysAdmins/certificate/certificate7.png?mtime=1360155190"><img alt="" src="http://blogs.lessthandot.com/media/blogs/SysAdmins/certificate/certificate7.png?mtime=1360155190" width="226" height="193" /></a></div>

<p>Select https as the type and set the port and select your certificate by its friendly name.</p>

<div class="image_block"><a href="http://blogs.lessthandot.com/media/blogs/SysAdmins/certificate/certificate8.png?mtime=1360155319"><img alt="" src="http://blogs.lessthandot.com/media/blogs/SysAdmins/certificate/certificate8.png?mtime=1360155319" width="490" height="226" /></a></div>

<h2>The clients</h2>

<p>Now it's time to configure our clients. </p>

<p>Since we are on a domain controller we can use a group policy for that.</p>

<p>First we need to get the certificate.</p>

<p>Now open MMC on your webserver and add certificates for your computer account on your local machine. </p>

<p>Then go to personal and certificates. Right-click on your certificate and select export.</p>

<div class="image_block"><a href="http://blogs.lessthandot.com/media/blogs/SysAdmins/certificate/certificate9.png?mtime=1360155468"><img alt="" src="http://blogs.lessthandot.com/media/blogs/SysAdmins/certificate/certificate9.png?mtime=1360155468" width="825" height="215" /></a></div>

<p>Remeber where you parked it and copy it to your domain controller.</p>

<p>Now open the Group policy manager.</p>

<p>Click on your Default Domain Policy.</p>

<p>Go to Computer configuration -> Policies -> Windows settings -> Security settings -> Public key policies -> Trusted Root Certification Authorities -> Take a deep breath.</p>

<p>Now right click that and select import.</p>

<div class="image_block"><a href="http://blogs.lessthandot.com/media/blogs/SysAdmins/certificate/certificate10.png?mtime=1360156026"><img alt="" src="http://blogs.lessthandot.com/media/blogs/SysAdmins/certificate/certificate10.png?mtime=1360156026" width="396" height="412" /></a></div>

<p>Select your certificate that you exported a while ago and wait for the clients to replicate.</p>

<p>Done.</p>

<p>Now you get this.</p>

<div class="image_block"><a href="http://blogs.lessthandot.com/media/blogs/SysAdmins/certificate/certificate11.png?mtime=1360156204"><img alt="" src="http://blogs.lessthandot.com/media/blogs/SysAdmins/certificate/certificate11.png?mtime=1360156204" width="573" height="246" /></a></div>

<p>No, it's not fully trusted but it no longer gives a warning either.</p>

<p>And Chris is happy.</p>

<h2>Conclusion</h2>

<p>This is here for my own reference.</p><div class="item_footer"><p><small><a href="http://blogs.lessthandot.com/index.php/SysAdmins/OS/Windows/2008Server/making-your-own-local-root">Original post</a> blogged on <a href="http://lessthandot.com/">LessThanDot</a>.</small></p></div>]]></content:encoded>
								<comments>http://blogs.lessthandot.com/index.php/SysAdmins/OS/Windows/2008Server/making-your-own-local-root#comments</comments>
			<wfw:commentRss>http://blogs.lessthandot.com/index.php/SysAdmins/?tempskin=_rss2&#38;disp=comments&#38;p=2082</wfw:commentRss>
		</item>
			</channel>
</rss>
