<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2spanishfull.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Climens' Codelog</title>
	
	<link>http://codelog.climens.net</link>
	<description>Development, productivity, blogging, technology, life in the trenches...</description>
	<lastBuildDate>Fri, 23 Mar 2012 15:58:30 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/ClimensCodelog" /><feedburner:info uri="climenscodelog" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><geo:lat>39.473488</geo:lat><geo:long>-0.38939</geo:long><feedburner:feedFlare href="http://www.newsgator.com/ngs/subscriber/subext.aspx?url=http%3A%2F%2Ffeeds.feedburner.com%2FClimensCodelog" src="http://www.newsgator.com/images/ngsub1.gif">Subscribe with NewsGator</feedburner:feedFlare><feedburner:feedFlare href="http://www.netvibes.com/subscribe.php?url=http%3A%2F%2Ffeeds.feedburner.com%2FClimensCodelog" src="http://www.netvibes.com/img/add2netvibes.gif">Subscribe with Netvibes</feedburner:feedFlare><feedburner:feedFlare href="http://fusion.google.com/add?feedurl=http%3A%2F%2Ffeeds.feedburner.com%2FClimensCodelog" src="http://buttons.googlesyndication.com/fusion/add.gif">Subscribe with Google</feedburner:feedFlare><feedburner:feedFlare href="http://www.pageflakes.com/subscribe.aspx?url=http%3A%2F%2Ffeeds.feedburner.com%2FClimensCodelog" src="http://www.pageflakes.com/ImageFile.ashx?instanceId=Static_4&amp;fileName=ATP_blu_91x17.gif">Subscribe with Pageflakes</feedburner:feedFlare><feedburner:feedFlare href="http://add.my.yahoo.com/content?lg=es&amp;url=http%3A%2F%2Ffeeds.feedburner.com%2FClimensCodelog" src="http://eur.i1.yimg.com/eur.yimg.com/i/es/my/addto1.gif">Subscribe with My Yahoo!</feedburner:feedFlare><feedburner:feedFlare href="http://www.feedness.com/alta/http://feeds.feedburner.com/ClimensCodelog" src="http://www.feedness.com/ayuda/wp-content/square_b_sh_feed.gif">Subscribe with Feedness</feedburner:feedFlare><item>
		<title>Lessons learned optimizing MySQL</title>
		<link>http://feedproxy.google.com/~r/ClimensCodelog/~3/YSTIcwmm_W4/</link>
		<comments>http://codelog.climens.net/2011/08/05/lessons-learned-optimizing-mysql/#comments</comments>
		<pubDate>Fri, 05 Aug 2011 11:41:18 +0000</pubDate>
		<dc:creator>climens</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[optimization]]></category>
		<category><![CDATA[performance]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://codelog.climens.net/?p=409</guid>
		<description><![CDATA[This week I&#8217;ve been quite entertained at work optimizing a big MySQL database, 18M rows and about 10Gb of table data for a high traffic web site (11M unique views per month). Not optimizing for perfomance is overkill in this case, so I have been learning and enjoying a lot during these days. The first [...]]]></description>
			<content:encoded><![CDATA[<p>This week I&#8217;ve been quite entertained at work optimizing a big <a href="http://dev.mysql.com/">MySQL database</a>, 18M rows and about 10Gb of table data for a high traffic web site (11M unique views per month). Not optimizing for perfomance is overkill in this case, so I have been learning and enjoying a lot during these days.</p>
<p>The first thing to note is that <strong>database servers are complex beasts</strong> (don&#8217;t underestimate them) and each and every database provider has its own strengths but also its own caveats.</p>
<p><img class="alignleft size-full wp-image-410" src="http://codelog.climens.net/files/2011/08/logo-mysql-110x57.png" alt="MySQL logo" width="110" height="110" />Sooner or later you&#8217;ll face a behavior that may seem counter-intuitive and there&#8217;s when you must <strong>read a lot of documentation</strong>. In this case, <a href="http://www.mysqlperformanceblog.com/">MySQL Performance Blog</a> and <a href="http://dev.mysql.com/doc/refman/5.5/en/">MySQL documentation</a> have been of great help, as well as the now unmantained-but-still-useful <a href="http://hackmysql.com/">Hack MySQL</a> site, which provides great tips very well explained.</p>
<p>Second. As always, <strong>doing an 80% optimization consumes 20% of the time</strong> and most of it is quite straightforward. <code>EXPLAIN</code>, review results, create index, <code>EXPLAIN</code> again. This way you can do a good job just knowing some indexing basics. Your indexes may be a bit fat, but will do the job.</p>
<p>Then you&#8217;ll need to <strong>be patient</strong>, creating indexes is not always fast, in fact the number, size and heterogeneusy of the columns involved will increase the time it takes to create them. While you wait, the best is to read good books about MySQL or relational databases like: <a href="http://www.amazon.com/gp/product/0471719994/ref=as_li_ss_tl?ie=UTF8&amp;tag=climecodel-20&amp;linkCode=as2&amp;camp=217145&amp;creative=399373&amp;creativeASIN=0471719994">Relational Database Index Design and the Optimizers</a><img src="http://www.assoc-amazon.com/e/ir?t=&amp;l=as2&amp;o=1&amp;a=0471719994&amp;camp=217145&amp;creative=399373" width="1" height="1" border="0" alt="" style="border:none !important;margin:0px !important" />.</p>
<p>You&#8217;ll need to <strong>be organized</strong>. Creating indexes randomly just looking a couple of slow <code>SELECT</code>s is something, but you must look at the big picture: make an inventory of all the application queries, no matter how unimportant look like because if they attack a big table with a WHERE or an <code>ORDER BY</code> they will perform bad. Fact. This list will help you organize the indexes and see which ones are used and which not and where.</p>
<p>Learn as well <strong>what the configuration parameters mean</strong>, MySQL has a bunch of them. Just increasing numbers will not always solve your bottlenecks. If you see something strange, there might be a parameter misconfigured and causing bad results.</p>
<p>Sometimes you&#8217;ll <strong>find yourself frustrated</strong> by something that you can&#8217;t understand. I found that almost anything in this field has an explanation, even a reasonable one.</p>
<p>Finally, don&#8217;t overlook other thinks. <strong>Database performance is important</strong> but there may be a lot of room to improve in your code, don&#8217;t blame MySQL as the root of all problems!</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/ClimensCodelog?a=YSTIcwmm_W4:jVN_rL8K8yE:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/ClimensCodelog?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/ClimensCodelog?a=YSTIcwmm_W4:jVN_rL8K8yE:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/ClimensCodelog?i=YSTIcwmm_W4:jVN_rL8K8yE:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/ClimensCodelog?a=YSTIcwmm_W4:jVN_rL8K8yE:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/ClimensCodelog?i=YSTIcwmm_W4:jVN_rL8K8yE:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/ClimensCodelog?a=YSTIcwmm_W4:jVN_rL8K8yE:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/ClimensCodelog?i=YSTIcwmm_W4:jVN_rL8K8yE:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/ClimensCodelog?a=YSTIcwmm_W4:jVN_rL8K8yE:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/ClimensCodelog?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/ClimensCodelog?a=YSTIcwmm_W4:jVN_rL8K8yE:t4U8cFwb1qM"><img src="http://feeds.feedburner.com/~ff/ClimensCodelog?d=t4U8cFwb1qM" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/ClimensCodelog/~4/YSTIcwmm_W4" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://codelog.climens.net/2011/08/05/lessons-learned-optimizing-mysql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://codelog.climens.net/2011/08/05/lessons-learned-optimizing-mysql/</feedburner:origLink></item>
		<item>
		<title>Simple Mini Profiler Glimpse plugin</title>
		<link>http://feedproxy.google.com/~r/ClimensCodelog/~3/eKoNFPPrYpo/</link>
		<comments>http://codelog.climens.net/2011/06/19/simple-mini-profiler-glimpse-plugin/#comments</comments>
		<pubDate>Sun, 19 Jun 2011 16:01:35 +0000</pubDate>
		<dc:creator>climens</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[ASP.NET MVC]]></category>
		<category><![CDATA[glimpse]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[profiler]]></category>

		<guid isPermaLink="false">http://codelog.climens.net/?p=389</guid>
		<description><![CDATA[I recently published on Github a simple small project (miniprofiler-glimpse-plugin) to integrate the results collected by the excellent MVC Mini Profiler created by the people at Stackoverflow with Glimpse, the Firebug for ASP.NET and MVC applications. Creating Glimpse plugins is really easy (just implement IGlimpsePlugin and decorate it with GlimpsePluginAttribute), implement the methods and reference [...]]]></description>
			<content:encoded><![CDATA[<p>I recently published on Github a simple small project (<a href="https://github.com/mcliment/miniprofiler-glimpse-plugin">miniprofiler-glimpse-plugin</a>) to integrate the results collected by the excellent <a href="https://code.google.com/p/mvc-mini-profiler/">MVC Mini Profiler</a> created by the people at Stackoverflow with <a href="http://getglimpse.com/">Glimpse</a>, the Firebug for ASP.NET and MVC applications.</p>
<p>Creating Glimpse plugins is really easy (just implement <code>IGlimpsePlugin</code> and decorate it with <code>GlimpsePluginAttribute</code>), implement the methods and reference the plug-in assembly in the project where you are using Glimpse. <a href="http://mef.codeplex.com/">MEF</a> will do the gluing and the <a href="http://json.codeplex.com/">JSON.NET</a> will do its best to deserialize the results in a human readable way.</p>
<p>To use this plug-in, just compile it and reference the assembly in your Glimpse-enabled project. I you have questions, suggestions or bug reports, you can use Github&#8217;s own issue reporting system, drop me a line o fork the project and make your improvements.</p>
<p>So, I hope you like it.</p>
<p>Link: <a href="https://github.com/mcliment/miniprofiler-glimpse-plugin">miniprofiler-glimpse-plugin</a> [github.org]</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/ClimensCodelog?a=eKoNFPPrYpo:FjuTz8PmOw0:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/ClimensCodelog?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/ClimensCodelog?a=eKoNFPPrYpo:FjuTz8PmOw0:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/ClimensCodelog?i=eKoNFPPrYpo:FjuTz8PmOw0:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/ClimensCodelog?a=eKoNFPPrYpo:FjuTz8PmOw0:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/ClimensCodelog?i=eKoNFPPrYpo:FjuTz8PmOw0:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/ClimensCodelog?a=eKoNFPPrYpo:FjuTz8PmOw0:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/ClimensCodelog?i=eKoNFPPrYpo:FjuTz8PmOw0:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/ClimensCodelog?a=eKoNFPPrYpo:FjuTz8PmOw0:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/ClimensCodelog?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/ClimensCodelog?a=eKoNFPPrYpo:FjuTz8PmOw0:t4U8cFwb1qM"><img src="http://feeds.feedburner.com/~ff/ClimensCodelog?d=t4U8cFwb1qM" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/ClimensCodelog/~4/eKoNFPPrYpo" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://codelog.climens.net/2011/06/19/simple-mini-profiler-glimpse-plugin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://codelog.climens.net/2011/06/19/simple-mini-profiler-glimpse-plugin/</feedburner:origLink></item>
		<item>
		<title>Carbon Copy Cloner saved my day</title>
		<link>http://feedproxy.google.com/~r/ClimensCodelog/~3/bzp85T01oZQ/</link>
		<comments>http://codelog.climens.net/2011/06/12/carbon-copy-cloner-saved-my-day/#comments</comments>
		<pubDate>Sun, 12 Jun 2011 21:13:43 +0000</pubDate>
		<dc:creator>climens</dc:creator>
				<category><![CDATA[Mac]]></category>

		<guid isPermaLink="false">http://codelog.climens.net/?p=381</guid>
		<description><![CDATA[This post is just an agreement to the great people behind Carbon Copy Cloner, a great piece of backup software for Mac. I trusted Time Machine, and actually it seemed a good program and a very convenient way of making and managing backups but&#8230; it does not matter how pretty is if when you need [...]]]></description>
			<content:encoded><![CDATA[<p>This post is just an agreement to the great people behind <a title="Carbon Copy Cloner" href="http://www.bombich.com/">Carbon Copy Cloner</a>, a great piece of backup software for Mac.</p>
<p>I trusted Time Machine, and actually it seemed a good program and a very convenient way of making and managing backups but&#8230; it does not matter how pretty is if when you need to restore a backup it gives you strange errors.</p>
<p><img class="alignright size-full wp-image-383" src="http://codelog.climens.net/files/2011/06/carbon_copy_cloner_logo.jpg" alt="" width="261" height="83" />The whole story is that I wanted to upgrade my Mac hard drive to a bigger one and <a href="http://docs.info.apple.com/article.html?path=Mac/10.6/en/15638.html">reading Time Machine documentation</a>, seems that I can use the OSX Installation disk to restore a backup to a new fresh drive. Well, that&#8217;s just theory but when doing as instructed I got an &#8220;Error -22&#8243; after about an hour restoring&#8230; epic fail. Good that I did keep the original drive untouched.</p>
<p>Then I tried donationware Carbon Copy Cloner to create a bootable clone backup of my working hard drive. After a couple of hours I had an external USB that mimicked my original drive. I replaced the hard drive, created a new partition and cloned again the external drive backup to the new one. Now I&#8217;m writing this on my upgraded Mac.</p>
<p>So, thanks to Carbon Copy Cloner from Bombich I was able to upgrade without problems. Great job!</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/ClimensCodelog?a=bzp85T01oZQ:QkubCl83_OA:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/ClimensCodelog?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/ClimensCodelog?a=bzp85T01oZQ:QkubCl83_OA:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/ClimensCodelog?i=bzp85T01oZQ:QkubCl83_OA:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/ClimensCodelog?a=bzp85T01oZQ:QkubCl83_OA:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/ClimensCodelog?i=bzp85T01oZQ:QkubCl83_OA:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/ClimensCodelog?a=bzp85T01oZQ:QkubCl83_OA:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/ClimensCodelog?i=bzp85T01oZQ:QkubCl83_OA:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/ClimensCodelog?a=bzp85T01oZQ:QkubCl83_OA:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/ClimensCodelog?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/ClimensCodelog?a=bzp85T01oZQ:QkubCl83_OA:t4U8cFwb1qM"><img src="http://feeds.feedburner.com/~ff/ClimensCodelog?d=t4U8cFwb1qM" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/ClimensCodelog/~4/bzp85T01oZQ" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://codelog.climens.net/2011/06/12/carbon-copy-cloner-saved-my-day/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://codelog.climens.net/2011/06/12/carbon-copy-cloner-saved-my-day/</feedburner:origLink></item>
		<item>
		<title>Troubleshooting MSDTC, RPC and NServiceBus issues</title>
		<link>http://feedproxy.google.com/~r/ClimensCodelog/~3/AYxiwxdsElE/</link>
		<comments>http://codelog.climens.net/2011/06/06/troubleshooting-msdtc-rpc-and-nservicebus-issues/#comments</comments>
		<pubDate>Mon, 06 Jun 2011 16:19:47 +0000</pubDate>
		<dc:creator>climens</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[msdtc]]></category>
		<category><![CDATA[nservicebus]]></category>
		<category><![CDATA[rpc]]></category>
		<category><![CDATA[troubleshooting]]></category>

		<guid isPermaLink="false">http://codelog.climens.net/?p=350</guid>
		<description><![CDATA[At first it seemed easy, but it&#8217;s been a long distance hurdle race. At the end, I have solved the problems I&#8217;ve found and my painful experience can be useful for other people, so this is it. First of all, my topology is the following: a client, in this case for testing purposes, my machine, [...]]]></description>
			<content:encoded><![CDATA[<p>At first it seemed easy, but it&#8217;s been a long distance hurdle race. At the end, I have solved the problems I&#8217;ve found and my painful experience can be useful for other people, so this is it.</p>
<p>First of all, my topology is the following: a client, in this case for testing purposes, my machine, which is running an ASP.NET web application and a NServiceBus host that processes all the messages. This has been configured following <a href="http://www.nservicebus.com/Documentation.aspx">the official documentation</a> and <a href="https://github.com/NServiceBus/NServiceBus/tree/master/Samples">looking at the samples</a> (check out the full <a href="https://github.com/NServiceBus/NServiceBus">NServiceBus source code</a>, you&#8217;ll need it). It&#8217;s a bit messy but with some trial and error you can make sense of it. There are some obscure properties that have to be googled to know what they mean.</p>
<p>Processing the messages is not trivial for the bus host. Some of them attack the database and need to use <abbr title="Microsoft Distributed Transaction Coordinator">MSDTC</abbr> to manage the transactions. This means that MSDTC must be up and running without problems.</p>
<p>One trick I learned after a lot of researching is <a href="http://blog.zoolutions.se/post/2010/04/01/Conquering-NServiceBus-part-5-e28093-Troubleshooting-DTC.aspx" class="broken_link">the <code>Runner.exe</code> tool from NServiceBus</a>. This comes with NServiceBus source code (and I think that also with paid version) and ends up in <code>build\tools\MsmqUtils</code> if you build it with <code>build.bat</code> or <code>build-net4.bat</code>. Just open a command line as administrator and run:</p>
<pre class="brush: plain; title: ; notranslate">Runner.exe /i</pre>
<p>This will install MSDTC and configure it properly. I don&#8217;t think you&#8217;ll need anything else but check the MSDTC configuration in <em>Component Services -&gt; Computers -&gt; My Computer -&gt; Distributed Transaction Coordinator -&gt; Local DTC</em>. Right click to go to properties and ensure everything is configured like in this <a href="http://blog.zoolutions.se/post/2010/04/01/Conquering-NServiceBus-part-5-e28093-Troubleshooting-DTC.aspx" class="broken_link">Troubleshooting DTC</a> post.</p>
<p>At this point, I recommend you to disable the Windows Firewall on both machines, at least for domain network, just to be sure it&#8217;s not interfering and breaking the tests, we will solve this later.</p>
<p>Then, <a href="http://www.microsoft.com/downloads/details.aspx?displaylang=en&amp;FamilyID=5e325025-4dcd-4658-a549-1d549ac17644">DTCPing</a> is your friend. This small tool will check the DTC connectivity between two machines. It&#8217;s a bit awkward. You have to start the tool in both machines, then put the name of the other and click ping on each one. This will make a test and if everything goes well, you&#8217;ll see a detailed log without errors:</p>
<pre class="brush: plain; title: ; notranslate">
++++++++++++Validating Remote Computer Name++++++++++++
Please refer to following log file for details:
	C:\tools\DTCPing\LOCALMACHINE2928.log
Invoking RPC method on REMOTEMACHINE
RPC test is successful
++++++++++++RPC test completed+++++++++++++++
++++++++++++Start DTC Binding Test +++++++++++++
Trying Bind to REMOTEMACHINE
Received reverse bind call from REMOTEMACHINE
Binding success: LOCALMACHINE--&gt;REMOTEMACHINE
++++++++++++DTC Binding Test END+++++++++++++
Please send following LOG to Microsoft for analysis:
	Partner LOG: REMOTEMACHINE5928.log
	My LOG: LOCALMACHINE2928.log
++++++++++++Start Reverse Bind Test+++++++++++++
Received Bind call from REMOTEMACHINE
Trying Reverse Bind to REMOTEMACHINE
Reverse Binding success: LOCALMACHINE--&gt;REMOTEMACHINE
++++++++++++Reverse Bind Test ENDED++++++++++
</pre>
<p>Here started my nightmare, I got the damned: <code>RPC error 5 (Access denied)</code>. After hours googling for the problem I found <a href="http://blogs.msdn.com/b/distributedservices/archive/2008/11/12/troubleshooting-msdtc-issues-with-the-dtcping-tool.aspx">this post about MSDTC problems</a> (I was looking for RPC problems, which actually was the root cause). The cause is that remote RPC is disabled in Windows workstations by default.</p>
<p>I opened for the N-th time the registry and added the RPC key to <code>HKLM\Software\Policies\Microsoft\Windows NT</code> and the RestrictRemoteClients DWORD value to 0. Rebooted without much hope. Magically, DTCPing worked and life seemed better and brighter.</p>
<p>Then, the Windows Firewall must be configured. In Windows Server 2008 (or Windows 7, it&#8217;s the same interface), go to Control Panel -&gt; System and Security -&gt; Windows Firewall (or just execute <code>firewall.cpl</code> at the command prompt). Go to Advanced Configuration to open a new window. Go to inbound rules and look for the Distributed Transaction Coordinator. If they are disabled, enable them. On the workstation the firewall can be enabled. Beware that DTCPing may not work, because the Firewall is only allowing connections to/from svchost.exe and msdtc.exe (if you want it to work, add a rule for that process).</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/ClimensCodelog?a=AYxiwxdsElE:xRVuhI0DFD0:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/ClimensCodelog?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/ClimensCodelog?a=AYxiwxdsElE:xRVuhI0DFD0:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/ClimensCodelog?i=AYxiwxdsElE:xRVuhI0DFD0:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/ClimensCodelog?a=AYxiwxdsElE:xRVuhI0DFD0:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/ClimensCodelog?i=AYxiwxdsElE:xRVuhI0DFD0:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/ClimensCodelog?a=AYxiwxdsElE:xRVuhI0DFD0:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/ClimensCodelog?i=AYxiwxdsElE:xRVuhI0DFD0:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/ClimensCodelog?a=AYxiwxdsElE:xRVuhI0DFD0:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/ClimensCodelog?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/ClimensCodelog?a=AYxiwxdsElE:xRVuhI0DFD0:t4U8cFwb1qM"><img src="http://feeds.feedburner.com/~ff/ClimensCodelog?d=t4U8cFwb1qM" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/ClimensCodelog/~4/AYxiwxdsElE" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://codelog.climens.net/2011/06/06/troubleshooting-msdtc-rpc-and-nservicebus-issues/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://codelog.climens.net/2011/06/06/troubleshooting-msdtc-rpc-and-nservicebus-issues/</feedburner:origLink></item>
		<item>
		<title>Using fail2ban with nginx in Debian</title>
		<link>http://feedproxy.google.com/~r/ClimensCodelog/~3/MQrkBKMsdCg/</link>
		<comments>http://codelog.climens.net/2011/02/13/using-fail2ban-with-nginx-in-debian/#comments</comments>
		<pubDate>Sun, 13 Feb 2011 13:03:16 +0000</pubDate>
		<dc:creator>climens</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Seguridad]]></category>
		<category><![CDATA[fail2ban]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[spam]]></category>

		<guid isPermaLink="false">http://codelog.climens.net/?p=336</guid>
		<description><![CDATA[Taking a look at the logwatch mails I see a common pattern of attacks, coming from China and trying to find details of my server configuration, which is something I dont like. Looking around I found fail2ban which is a tool that does som regex matches on the server logs (sshd, httpd, authd, &#8230;) and [...]]]></description>
			<content:encoded><![CDATA[<p>Taking a look at the logwatch mails I see a common pattern of attacks, coming from China and trying to find details of my server configuration, which is something I dont like.</p>
<p>Looking around I found <a href="http://www.fail2ban.org/">fail2ban</a> which is a tool that does som regex matches on the server logs (sshd, httpd, authd, &#8230;) and takes proper actions, like banning the offending IP.</p>
<p>I then installed fail2ban in my Debian box:</p>
<pre class="brush: plain; title: ; notranslate">
&gt; apt-get install fail2ban
</pre>
<p>Then, I took a look at /etc/fail2ban/jail.conf and found some entries for Apache but none for <a href="http://nginx.org/">nginx</a>, my server of choice, so I decided to create a <strong>jail.local</strong> to add some nginx stuff (this is recommended in Debian to allow hassle-free upgrades).</p>
<p>I started copying the Apache sections of the default fail2ban as the log files in my case use the same format that allows me to use Awstats easily. Then, I modified my log routes to point to the nginx ones and using Apache rules, if they don&#8217;t work I&#8217;ll tune them later.</p>
<pre class="brush: plain; title: ; notranslate">
[nginx]

enabled = true
port    = http,https
filter  = apache-auth
logpath = /var/log/nginx*/*error.log
maxretry = 6

[nginx-noscript]

enabled = false
port    = http,https
filter  = apache-noscript
logpath = /var/log/nginx*/*error.log
maxretry = 6

[nginx-overflows]

enabled = false
port    = http,https
filter  = apache-overflows
logpath = /var/log/nginx*/*error.log
maxretry = 2
</pre>
<p>Although this is ok, the bots I see don&#8217;t leave a trace in error.log but in access.log so I took a look at the filter.d folder where an interesting apache-badbots.conf was present. Then, I found the default fail2ban documentation in /usr/share/doc/fail2ban where there&#8217;s an usage example of the badbots script. I added I to my jail.local:</p>
<pre class="brush: plain; title: ; notranslate">
[apache-badbots]

enabled  = true
port    = http,http
filter   = apache-badbots
logpath  = /var/log/nginx*/*access.log
bantime  = 172800
maxretry = 1
</pre>
<p>Finally, I added this to the top of the file, to send mails to myself when a rule matches and a host is banned.</p>
<pre class="brush: plain; title: ; notranslate">
[DEFAULT]

action = %(action_mwl)s
</pre>
<p>Finally, restart the service and start receiving mails:</p>
<pre class="brush: plain; title: ; notranslate">
&gt; sudo /etc/init.d/fail2ban restart
</pre>
<p>I&#8217;m sure this will need further adjustments, but it&#8217;s a beginning in my bot fighting war. I&#8217;ll make some updates as I find interesting results.</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/ClimensCodelog?a=MQrkBKMsdCg:R9XKQ4lZoNg:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/ClimensCodelog?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/ClimensCodelog?a=MQrkBKMsdCg:R9XKQ4lZoNg:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/ClimensCodelog?i=MQrkBKMsdCg:R9XKQ4lZoNg:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/ClimensCodelog?a=MQrkBKMsdCg:R9XKQ4lZoNg:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/ClimensCodelog?i=MQrkBKMsdCg:R9XKQ4lZoNg:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/ClimensCodelog?a=MQrkBKMsdCg:R9XKQ4lZoNg:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/ClimensCodelog?i=MQrkBKMsdCg:R9XKQ4lZoNg:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/ClimensCodelog?a=MQrkBKMsdCg:R9XKQ4lZoNg:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/ClimensCodelog?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/ClimensCodelog?a=MQrkBKMsdCg:R9XKQ4lZoNg:t4U8cFwb1qM"><img src="http://feeds.feedburner.com/~ff/ClimensCodelog?d=t4U8cFwb1qM" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/ClimensCodelog/~4/MQrkBKMsdCg" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://codelog.climens.net/2011/02/13/using-fail2ban-with-nginx-in-debian/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		<feedburner:origLink>http://codelog.climens.net/2011/02/13/using-fail2ban-with-nginx-in-debian/</feedburner:origLink></item>
		<item>
		<title>How msiinv saved my day</title>
		<link>http://feedproxy.google.com/~r/ClimensCodelog/~3/AtQf8HEbIbs/</link>
		<comments>http://codelog.climens.net/2011/01/14/how-msiinv-saved-my-day/#comments</comments>
		<pubDate>Fri, 14 Jan 2011 10:22:31 +0000</pubDate>
		<dc:creator>climens</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[ASP.NET MVC]]></category>
		<category><![CDATA[MSI]]></category>

		<guid isPermaLink="false">http://codelog.climens.net/?p=327</guid>
		<description><![CDATA[In my previous post I reported my problems installing MVC3 in my machine. That led me to further investigation as that worked perfectly in my co-workers&#8217; machines. I tried to repair Visual Studio 2010 and told me that it had troubles with vs_setup.msi&#8230; strange. Looking around I found a post that led me to an [...]]]></description>
			<content:encoded><![CDATA[<p>In my <a href="http://codelog.climens.net/2011/01/12/install-asp-net-mvc-3-rc-manually/">previous post</a> I reported my problems installing MVC3 in my machine. That led me to further investigation as that worked perfectly in my co-workers&#8217; machines.</p>
<p>I tried to repair Visual Studio 2010 and told me that it had troubles with vs_setup.msi&#8230; strange. Looking around I found a post that led me to <a href="http://blogs.msdn.com/b/astebner/archive/2005/07/01/using-msiinv-to-gather-information-about-what-is-installed-on-a-computer.aspx">an explanation of the msiinv.exe tool</a>.</p>
<p>It took me a while to get the tool as the author&#8217;s site is broken, but Stackoverflow <a href="http://stackoverflow.com/questions/239264/anyone-got-a-copy-of-msiinv-exe">came on rescue</a>.</p>
<p>Then, I ran the tool:</p>
<pre class="brush: plain; title: ; notranslate">
msiinv -p &gt; msiinv.txt
</pre>
<p>Then opened the file and&#8230; surprise!</p>
<pre class="brush: plain; title: ; notranslate">
Microsoft Visual Studio 2010 Professional - ESN
    Product code:    {725041D1-9F45-30D3-A78E-DF08C4E1A297}
    Product state:    (1) The product is advertised, but not installed.
    Package code:    {9E58363D-E4A9-49D3-82B7-42584AFCA9E7}
    AssignmentType:    1
    Language:    3082
        Package:    vs_setup.msi
    0 patch packages.
</pre>
<p>Strange. I tried to fix it with MSI:</p>
<pre class="brush: plain; title: ; notranslate">
msiexec /f {725041D1-9F45-30D3-A78E-DF08C4E1A297}
</pre>
<p>It asked me for the vs_setup.msi, it&#8217;s in the root of the Visual Studio 2010 DVD in case it&#8217;s not found automatically. Magically it worked and now it&#8217;s installed:</p>
<pre class="brush: plain; title: ; notranslate">
Microsoft Visual Studio 2010 Professional - ESN
    Product code:    {725041D1-9F45-30D3-A78E-DF08C4E1A297}
    Product state:    (5) Installed.
    Package code:    {9E58363D-E4A9-49D3-82B7-42584AFCA9E7}
    Version:    10.0.30319
    AssignmentType:    1
    Publisher:    Microsoft Corporation
    Language:    3082
       Installed from: D:\VS2010\
    Package:    vs_setup.msi
    Help link:    http://go.microsoft.com/fwlink/?LinkId=133405
    Local package:    C:\Windows\Installer\3f3bc84.msi
    Install date:    2011&#092;&#048;1\14
    0 patch packages.
</pre>
<p>Great! Now the ASP.NET MVC3 RTM setup package worked like a charm.</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/ClimensCodelog?a=AtQf8HEbIbs:B5azwuXuHJI:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/ClimensCodelog?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/ClimensCodelog?a=AtQf8HEbIbs:B5azwuXuHJI:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/ClimensCodelog?i=AtQf8HEbIbs:B5azwuXuHJI:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/ClimensCodelog?a=AtQf8HEbIbs:B5azwuXuHJI:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/ClimensCodelog?i=AtQf8HEbIbs:B5azwuXuHJI:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/ClimensCodelog?a=AtQf8HEbIbs:B5azwuXuHJI:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/ClimensCodelog?i=AtQf8HEbIbs:B5azwuXuHJI:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/ClimensCodelog?a=AtQf8HEbIbs:B5azwuXuHJI:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/ClimensCodelog?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/ClimensCodelog?a=AtQf8HEbIbs:B5azwuXuHJI:t4U8cFwb1qM"><img src="http://feeds.feedburner.com/~ff/ClimensCodelog?d=t4U8cFwb1qM" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/ClimensCodelog/~4/AtQf8HEbIbs" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://codelog.climens.net/2011/01/14/how-msiinv-saved-my-day/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://codelog.climens.net/2011/01/14/how-msiinv-saved-my-day/</feedburner:origLink></item>
		<item>
		<title>Install ASP.NET MVC 3 Manually</title>
		<link>http://feedproxy.google.com/~r/ClimensCodelog/~3/4sJ2JS1pqjQ/</link>
		<comments>http://codelog.climens.net/2011/01/12/install-asp-net-mvc-3-rc-manually/#comments</comments>
		<pubDate>Wed, 12 Jan 2011 14:49:08 +0000</pubDate>
		<dc:creator>climens</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[ASP.NET MVC]]></category>

		<guid isPermaLink="false">http://codelog.climens.net/?p=320</guid>
		<description><![CDATA[Update 14-jan-2011: I found the root solution to all my problems with msiinv, check my post on the subject. I don&#8217;t know exactly why but I can&#8217;t install the MVC 3 package provided by Web Platform Installer nor the standalone one, so I uncompressed it and tried to figure out how to install it manually. [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Update 14-jan-2011:</strong> I found the root solution to all my problems with msiinv, check <a href="http://codelog.climens.net/2011/01/14/how-msiinv-saved-my-day/">my post on the subject</a>.</p>
<p>I don&#8217;t know exactly why but I can&#8217;t install the MVC 3 package provided by <a href="http://www.microsoft.com/web/downloads/platform.aspx">Web Platform Installer</a> nor the <a href="http://www.microsoft.com/downloads/en/details.aspx?FamilyID=d2928bc1-f48c-4e95-a064-2a455a22c8f6">standalone one</a>, so I uncompressed it and tried to figure out how to install it manually.</p>
<p><img class="alignright size-full wp-image-322" src="http://codelog.climens.net/files/2011/01/dotnetlogo.png" alt="" width="306" height="104" />The problem I have is with vs10-kb2465236-x86.exe that gives me a &#8220;failed with 0x8007066a&#8221; error. It seems to be for <a href="http://support.microsoft.com/kb/2465236/en-us">enabling Razor syntax</a> but the prerequisites are Visual Studio 2010 Ultimate ENU. I have Visual Studio 2010 Professional ESN and that may be the reason or may not.</p>
<p>Anyway, I found the way to install the package manually, although the Razor Intellisense stuff is not available in my setup.</p>
<p>First you have to uncompress the AspNetMVC3Setup.exe into a folder and then install the following files (I got the sequence from the parameterinfo.xml file, which describes the installation process):</p>
<ul>
<li><span style="text-decoration: line-through">VS10-KB2465236-x86.exe</span> (it fails in my case, I don&#8217;t install it)</li>
<li>AspNetWebPages.msi &#8211; ASP.NET Web Pages</li>
<li>AspNetWebPagesVS2010Tools.msi &#8211; ASP.NET Web Pages Visual Studio 2010 Tools</li>
<li>AspNetMVC3.msi &#8211; ASP.NET MVC 3 Runtime</li>
<li>AspNetMVC3VS2010Tools.msi &#8211; ASP.NET MVC 3 Visual Studio 2010 Tools</li>
<li>NuGet.msi &#8211; NuGet</li>
</ul>
<p>And that&#8217;s all. In case you have Web Developer Express instead of full Visual Studio, you have ton install the tools specifically for that edition, AspNetWebPagesVWD2010Tools.msi instead of AspNetWebPagesVS2010Tools.msi and AspNetMVC3VWD2010Tools.msi instead of AspNetMVC3VS2010Tools.msi.</p>
<p>Good luck!</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/ClimensCodelog?a=4sJ2JS1pqjQ:DwpBx3ydxA0:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/ClimensCodelog?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/ClimensCodelog?a=4sJ2JS1pqjQ:DwpBx3ydxA0:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/ClimensCodelog?i=4sJ2JS1pqjQ:DwpBx3ydxA0:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/ClimensCodelog?a=4sJ2JS1pqjQ:DwpBx3ydxA0:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/ClimensCodelog?i=4sJ2JS1pqjQ:DwpBx3ydxA0:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/ClimensCodelog?a=4sJ2JS1pqjQ:DwpBx3ydxA0:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/ClimensCodelog?i=4sJ2JS1pqjQ:DwpBx3ydxA0:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/ClimensCodelog?a=4sJ2JS1pqjQ:DwpBx3ydxA0:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/ClimensCodelog?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/ClimensCodelog?a=4sJ2JS1pqjQ:DwpBx3ydxA0:t4U8cFwb1qM"><img src="http://feeds.feedburner.com/~ff/ClimensCodelog?d=t4U8cFwb1qM" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/ClimensCodelog/~4/4sJ2JS1pqjQ" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://codelog.climens.net/2011/01/12/install-asp-net-mvc-3-rc-manually/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://codelog.climens.net/2011/01/12/install-asp-net-mvc-3-rc-manually/</feedburner:origLink></item>
		<item>
		<title>Deployment web site Zip with MsBuild and TeamCity</title>
		<link>http://feedproxy.google.com/~r/ClimensCodelog/~3/4MXfcNlSZYI/</link>
		<comments>http://codelog.climens.net/2010/11/30/deploymet-web-site-zip-with-msbuild-and-teamcity/#comments</comments>
		<pubDate>Tue, 30 Nov 2010 10:09:28 +0000</pubDate>
		<dc:creator>climens</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[continuous integration]]></category>
		<category><![CDATA[msbuild]]></category>
		<category><![CDATA[subversion]]></category>
		<category><![CDATA[teamcity]]></category>

		<guid isPermaLink="false">http://codelog.climens.net/?p=309</guid>
		<description><![CDATA[One of the most useful practices that I&#8217;ve been using during the last years is continuous integration and for that purpose, TeamCity is the tool of choice, which offers a free professional version with up to 20 users and 20 build configurations, enough for a small team. Recently I tried (again, first time I found [...]]]></description>
			<content:encoded><![CDATA[<p>One of the most useful practices that I&#8217;ve been using during the last years is continuous integration and for that purpose, <a href="http://www.jetbrains.com/teamcity/">TeamCity</a> is the tool of choice, which offers a free professional version with up to 20 users and 20 build configurations, enough for a small team.</p>
<p>Recently I tried (again, first time I found some trouble) to create an <a href="http://msdn.microsoft.com/en-us/library/0k6kkbsd.aspx">MsBuild</a> script to make a web publication to a folder an then zip that folder in order to make a simple distributable with all the things needed to set up our web project that anyone in the organization could download and install, instead of having to create that zip myself or publishing through Visual Studio.</p>
<p>Finally, I got the script and seems to work using <a href="http://msbuildtasks.tigris.org/">MsBuildCommunityTasks</a> and some community knowledge.</p>
<p>The first part deals with publishing the site:</p>
<pre class="brush: xml; title: ; notranslate">
  &lt;PropertyGroup&gt;
    &lt;OutputFolder&gt;$(MSBuildProjectDirectory)\publish&lt;/OutputFolder&gt;
    &lt;TempFolder&gt;$(MSBuildProjectDirectory)\temp\&lt;/TempFolder&gt;
  &lt;/PropertyGroup&gt;
  &lt;Target Name=&quot;PublishSite&quot;&gt;
    &lt;Message Text=&quot;Publishing in folder: $(OutputFolder)&quot; /&gt;
    &lt;RemoveDir Directories=&quot;$(OutputFolder);$(TempFolder)&quot; ContinueOnError=&quot;true&quot; /&gt;
    &lt;MSBuild
      Projects=&quot;src\Adapting.Web\Adapting.Web.csproj&quot;
      Targets=&quot;ResolveReferences;_WPPCopyWebApplication&quot;
      Properties=&quot;Configuration=Release;WebProjectOutputDir=$(OutputFolder);OutDir=$(TempFolder)&quot;
      StopOnFirstFailure=&quot;true&quot; /&gt;
    &lt;RemoveDir Directories=&quot;$(TempFolder)&quot; ContinueOnError=&quot;true&quot; /&gt;
  &lt;/Target&gt;
</pre>
<p>I define some variables and then I call the <code>_WPPCopyWebApplication</code> which is the important target (in .NET 2.0 was <code>_CopyWebApplication</code>). This should be the same as publishing a web site to a folder using the wizard.</p>
<p>Then, I get the files in the <code>OutputFolder</code> and make a zip with them:</p>
<pre class="brush: xml; title: ; notranslate">
  &lt;Target Name=&quot;PackageSite&quot; DependsOnTargets=&quot;PublishSite&quot;&gt;
    &lt;ItemGroup&gt;
      &lt;PublishFiles Include=&quot;$(OutputFolder)\**&quot; /&gt;
    &lt;/ItemGroup&gt;
    &lt;Message Text=&quot;Packaging Site&quot; /&gt;
    &lt;Zip
      Files=&quot;@(PublishFiles)&quot;
      ZipFileName=&quot;release-web.zip&quot;
      WorkingDirectory=&quot;$(OutputFolder)&quot;
      /&gt;
  &lt;/Target&gt;
</pre>
<p>I simplified this a little bit because I have as well a target that generates the build number from SVN and changes the <code>AssemblyInfo.cs</code> and uses this numbers to name the zip.</p>
<p>In TeamCity, you can create a new configuration with <code>*.zip</code> as artifacts, that points to your SCM (Subversion in my case) and the most important thing is that uses the MsBuild runner targeting <code>PackageSite</code>.</p>
<p>The only thing that was that if I put the <code>&lt;ItemGroup&gt;</code> section out of the <code>&lt;Target&gt;</code>, works on the command line but not inside TeamCity.</p>
<p>That&#8217;s all, I hope this helps.</p>
<p>Sources:</p>
<ul>
<li><a href="http://codingcockerel.co.uk/2008/05/18/how-to-publish-a-web-site-with-msbuild/">How to publish a web site with MsBuild</a></li>
<li><a href="http://blog.benhall.me.uk/2008/09/using-msbuild-to-create-deployment-zip.html">Using MsBuild to create a deployment zip</a></li>
</ul>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/ClimensCodelog?a=4MXfcNlSZYI:P0-LfXvsfJA:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/ClimensCodelog?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/ClimensCodelog?a=4MXfcNlSZYI:P0-LfXvsfJA:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/ClimensCodelog?i=4MXfcNlSZYI:P0-LfXvsfJA:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/ClimensCodelog?a=4MXfcNlSZYI:P0-LfXvsfJA:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/ClimensCodelog?i=4MXfcNlSZYI:P0-LfXvsfJA:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/ClimensCodelog?a=4MXfcNlSZYI:P0-LfXvsfJA:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/ClimensCodelog?i=4MXfcNlSZYI:P0-LfXvsfJA:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/ClimensCodelog?a=4MXfcNlSZYI:P0-LfXvsfJA:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/ClimensCodelog?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/ClimensCodelog?a=4MXfcNlSZYI:P0-LfXvsfJA:t4U8cFwb1qM"><img src="http://feeds.feedburner.com/~ff/ClimensCodelog?d=t4U8cFwb1qM" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/ClimensCodelog/~4/4MXfcNlSZYI" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://codelog.climens.net/2010/11/30/deploymet-web-site-zip-with-msbuild-and-teamcity/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://codelog.climens.net/2010/11/30/deploymet-web-site-zip-with-msbuild-and-teamcity/</feedburner:origLink></item>
		<item>
		<title>Testing ConfigurationSection</title>
		<link>http://feedproxy.google.com/~r/ClimensCodelog/~3/-J7GpW9OUtA/</link>
		<comments>http://codelog.climens.net/2010/11/24/testing-configurationsection/#comments</comments>
		<pubDate>Wed, 24 Nov 2010 14:17:15 +0000</pubDate>
		<dc:creator>climens</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[bugs]]></category>
		<category><![CDATA[mvccontrib]]></category>
		<category><![CDATA[testing]]></category>

		<guid isPermaLink="false">http://codelog.climens.net/?p=301</guid>
		<description><![CDATA[Creating ConfigurationSections can be tricky but it&#8217;s quite straightforward to test them, provided you take care and don&#8217;t try to do too much like this subtle bug in MvcContrib.IncludeHandling that lead me crazy for a couple of hours. The thing is that the code does like this: Where this is the constructor and .Css and [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://codelog.climens.net/files/2010/11/logoset-final.jpg" alt="" width="293" height="100" class="alignright size-full wp-image-307" />Creating <a href="http://msdn.microsoft.com/en-us/library/system.configuration.configurationsection.aspx">ConfigurationSection</a>s can be tricky but it&#8217;s quite straightforward to test them, provided you take care and don&#8217;t try to do too much like this subtle bug in <a href="http://mvccontrib.codeplex.com/">MvcContrib</a>.IncludeHandling that lead me crazy for a couple of hours.</p>
<p>The thing is that the code does like this:</p>
<pre class="brush: csharp; title: ; notranslate">
public IncludeHandlingSectionHandler()
{
    _types = new Dictionary&lt;IncludeType, IIncludeTypeSettings&gt;
    {
        { IncludeType.Css, Css },
        { IncludeType.Js, Js }
    };
}
</pre>
<p>Where this is the constructor and .Css and .Js properties are marked with <a href="http://msdn.microsoft.com/en-us/library/system.configuration.configurationpropertyattribute.aspx">[ConfigurationProperty]</a>, so in theory seems correct.</p>
<p>In the tests, there&#8217;s an XML file with the section and it&#8217;s loaded using the <a href="http://msdn.microsoft.com/en-us/library/system.configuration.configurationsection.deserializesection.aspx">DeserializeSection</a> method of the ConfigurationSection base class. And this seems correct, everything goes ok and the dictionary is populated correctly with the data from the XML file.</p>
<p>But it&#8217;s wrong. If you add the section to the app.config (or web.config) file and instead of using DeserializeSection you use <a href="http://msdn.microsoft.com/en-us/library/system.configuration.configurationmanager.getsection.aspx">ConfigurationManager.GetSection(sectionName)</a>, the constructor is called <strong>before </strong>populating the Css and Js properties so the dictionary is not created properly but as those properties return a default implementation in case there&#8217;s no configuration, it seems to work, but the configured values are never loaded.</p>
<p>This way, tests pass but it&#8217;s impossible to configure the library via web.config. Anyway, in my opinion the problem is in .NET Framework because internally, GetSection should use DeserializeSection to be consistent.</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/ClimensCodelog?a=-J7GpW9OUtA:VwkKIGcopyE:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/ClimensCodelog?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/ClimensCodelog?a=-J7GpW9OUtA:VwkKIGcopyE:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/ClimensCodelog?i=-J7GpW9OUtA:VwkKIGcopyE:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/ClimensCodelog?a=-J7GpW9OUtA:VwkKIGcopyE:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/ClimensCodelog?i=-J7GpW9OUtA:VwkKIGcopyE:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/ClimensCodelog?a=-J7GpW9OUtA:VwkKIGcopyE:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/ClimensCodelog?i=-J7GpW9OUtA:VwkKIGcopyE:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/ClimensCodelog?a=-J7GpW9OUtA:VwkKIGcopyE:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/ClimensCodelog?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/ClimensCodelog?a=-J7GpW9OUtA:VwkKIGcopyE:t4U8cFwb1qM"><img src="http://feeds.feedburner.com/~ff/ClimensCodelog?d=t4U8cFwb1qM" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/ClimensCodelog/~4/-J7GpW9OUtA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://codelog.climens.net/2010/11/24/testing-configurationsection/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://codelog.climens.net/2010/11/24/testing-configurationsection/</feedburner:origLink></item>
		<item>
		<title>Get MAC from IP address in .NET</title>
		<link>http://feedproxy.google.com/~r/ClimensCodelog/~3/SQlfqGtihzQ/</link>
		<comments>http://codelog.climens.net/2010/06/14/get-mac-from-ip-address-in-net/#comments</comments>
		<pubDate>Mon, 14 Jun 2010 07:38:36 +0000</pubDate>
		<dc:creator>climens</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[networking]]></category>

		<guid isPermaLink="false">http://codelog.climens.net/?p=259</guid>
		<description><![CDATA[After dealing with several options, most of them involving a call to a command line tool and parsing the output, which is not really elegant. Other solutions were based on obsolete VBScript client code and ActiveX, even worse. Finally I found in the excellent pinvoke.net site a very nice and simple example using a simple [...]]]></description>
			<content:encoded><![CDATA[<p>After dealing with several options, most of them involving a call to a command line tool and parsing the output, which is not really elegant. Other solutions were based on obsolete VBScript client code and ActiveX, even worse.</p>
<p>Finally I found in the excellent <a href="http://www.pinvoke.net/">pinvoke.net</a> site <a href="http://www.pinvoke.net/default.aspx/iphlpapi.SendARP">a very nice and simple example</a> using a simple call to iphlpapi.dll&#8217;s SendARP method. The trick was to use <a href="http://en.wikipedia.org/wiki/Address_Resolution_Protocol">ARP</a> to get the MAC from the IP.</p>
<p>Note that this has it&#8217;s limitations, as I will only work if the remote machine is in the same network and the packet does not need to go through a router. I was enough for our needs.</p>
<p>Here&#8217;s the code I adapted from the example:</p>
<pre class="brush: csharp; title: ; notranslate">
public static string GetMAC(IPAddress ipAddr)
{
var mac = new byte[6];
var len = (uint)mac.Length;

var result = SendARP((int)ipAddr.Address, 0, mac, ref len);

if (result != 0)
{
return &quot;MAC not found!&quot;;
}

var str = new string[(int)len];

for (var i = 0; i &amp;lt; len; i++)
{
str[i] = mac[i].ToString(&quot;x2&quot;);
}

return string.Join(&quot;:&quot;, str);
}

[DllImport(&quot;iphlpapi.dll&quot;, ExactSpelling = true)]
private static extern int SendARP(int destIP, int srcIP, byte[] pMacAddr, ref uint phyAddrLen);
</pre>
<p>Enjoy!</p>
<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/ClimensCodelog?a=SQlfqGtihzQ:Hc70RUhgwzY:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/ClimensCodelog?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/ClimensCodelog?a=SQlfqGtihzQ:Hc70RUhgwzY:D7DqB2pKExk"><img src="http://feeds.feedburner.com/~ff/ClimensCodelog?i=SQlfqGtihzQ:Hc70RUhgwzY:D7DqB2pKExk" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/ClimensCodelog?a=SQlfqGtihzQ:Hc70RUhgwzY:F7zBnMyn0Lo"><img src="http://feeds.feedburner.com/~ff/ClimensCodelog?i=SQlfqGtihzQ:Hc70RUhgwzY:F7zBnMyn0Lo" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/ClimensCodelog?a=SQlfqGtihzQ:Hc70RUhgwzY:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/ClimensCodelog?i=SQlfqGtihzQ:Hc70RUhgwzY:V_sGLiPBpWU" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/ClimensCodelog?a=SQlfqGtihzQ:Hc70RUhgwzY:qj6IDK7rITs"><img src="http://feeds.feedburner.com/~ff/ClimensCodelog?d=qj6IDK7rITs" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/ClimensCodelog?a=SQlfqGtihzQ:Hc70RUhgwzY:t4U8cFwb1qM"><img src="http://feeds.feedburner.com/~ff/ClimensCodelog?d=t4U8cFwb1qM" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/ClimensCodelog/~4/SQlfqGtihzQ" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://codelog.climens.net/2010/06/14/get-mac-from-ip-address-in-net/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://codelog.climens.net/2010/06/14/get-mac-from-ip-address-in-net/</feedburner:origLink></item>
	</channel>
</rss>

