<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://weblogs.asp.net/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>ASP.NET Weblogs</title><link>http://weblogs.asp.net/</link><description /><dc:language>en-US</dc:language><generator>CommunityServer 2007 SP1 (Build: 20510.895)</generator><item><title>Keep Calm And PowerShell On</title><link>http://weblogs.asp.net/sbchatterjee/archive/2012/05/16/keep-calm-and-powershell-on.aspx</link><pubDate>Wed, 16 May 2012 10:08:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:8486116</guid><dc:creator>SB Chatterjee</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;Another variation of the &lt;a href="http://en.wikipedia.org/wiki/Keep_Calm_and_Carry_On" target="_blank"&gt;historic poster from WW2&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://weblogs.asp.net/blogs/sbchatterjee/KCPOSH_38809E89.jpg"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="KCPOSH" border="0" alt="KCPOSH" src="http://weblogs.asp.net/blogs/sbchatterjee/KCPOSH_thumb_09BAE5E7.jpg" width="228" height="244" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;SharePoint variations &lt;a href="http://weblogs.asp.net/sbchatterjee/archive/2012/05/12/keep-calm-and-sharepoint.aspx" target="_blank"&gt;here…&lt;/a&gt;&lt;/p&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=8486116" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/sbchatterjee/archive/tags/Community+News/default.aspx">Community News</category><category domain="http://weblogs.asp.net/sbchatterjee/archive/tags/General/default.aspx">General</category><category domain="http://weblogs.asp.net/sbchatterjee/archive/tags/General+Software+Development/default.aspx">General Software Development</category><category domain="http://weblogs.asp.net/sbchatterjee/archive/tags/Microsoft/default.aspx">Microsoft</category><category domain="http://weblogs.asp.net/sbchatterjee/archive/tags/Sharepoint/default.aspx">Sharepoint</category><category domain="http://weblogs.asp.net/sbchatterjee/archive/tags/PowerShell/default.aspx">PowerShell</category></item><item><title>Getting Started with ASP.NET MVC 3, Logging, and Depency Injection</title><link>http://weblogs.asp.net/bsimser/archive/2012/05/15/getting-started-with-asp-net-mvc-3-logging-and-depency-injection.aspx</link><pubDate>Wed, 16 May 2012 01:35:43 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:8484043</guid><dc:creator>Bil Simser</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;I started a new ASP.NET MVC project recently and wanted to give you a little insight on kicking off new projects. There’s some setup time you want to spend setting up your solution and getting the plumbing in order before you dive into writing unit tests and building out your site. &lt;/p&gt;  &lt;p&gt;For a full on, blow my mind, ultimate guide you *have* to go watch &lt;a href="http://blog.wekeroad.com/"&gt;Rob Conery&lt;/a&gt; and his 90 minute walkthrough of setting up his MVC projects. I’ve watched this video a few times and Rob is awesome and knows his stuff. The tips he gives are gold. You can also check out the &lt;a href="http://mvc3starter.codeplex.com/"&gt;MVC 3 Starter Kit&lt;/a&gt; on CodePlex which is based on his &lt;a href="http://mvcstarter.codeplex.com/"&gt;MVC 2 Starter&lt;/a&gt; code but I found it was lacking a few features. In any case, go watch his video for the full meal deal either &lt;a href="http://youtu.be/U_Y2IJd2HjE"&gt;here on YouTube&lt;/a&gt; or &lt;a href="http://tekpub.com/view/dotnet-oss/4"&gt;here on TekPub&lt;/a&gt;. This post is just a mere shadow of his work but updates the use of Ninject with MVC 3.&lt;/p&gt;  &lt;p&gt;Okay, so we’re going to be doing some simple plumbing to get this going. We’ll put together the Hello World MVC 3 app, add in a logging system, and plumb in dependency injection in just a few minutes.&lt;/p&gt;  &lt;p&gt;You’ll need Visual Studio 2010 with MVC 3 and NuGet installed. You can get MVC 3 from the main site &lt;a href="http://www.asp.net/mvc/mvc3"&gt;here&lt;/a&gt;. Next install NuGet from &lt;a href="http://nuget.org/"&gt;here&lt;/a&gt;. The MVC 3 framework is obviously needed (Visual Studio 2010 only comes with MVC 2 out of the box) and NuGet is used to install our additional libraries (trust me, if you haven’t used NuGet before it will blow your mind).&lt;/p&gt;  &lt;p&gt;First steps is to build a new MVC 3 app. File &amp;gt; New Project. Then select Visual C# &amp;gt; Web &amp;gt; ASP.NET MVC 3 Application and give it a name.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://weblogs.asp.net/blogs/bsimser/image_221D877F.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://weblogs.asp.net/blogs/bsimser/image_thumb_67C2119D.png" width="502" height="347" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Click OK and you’ll see the options dialog for a new MVC 3 Application.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://weblogs.asp.net/blogs/bsimser/image_146ACB77.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://weblogs.asp.net/blogs/bsimser/image_thumb_3E6AC99F.png" width="502" height="453" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Pick Internet application as it will work for most everyone (Windows authentication works fine too but for this post it’s just easier to go with Internet). Let’s choose Razor for the view engine (ASPX is so 2011) and use HTML 5 markup (hey, it’s just a demo). We won’t create a unit test project but in a real project you’ll create one (or create a class library separately so you can use other unit testing frameworks). &lt;/p&gt;  &lt;p&gt;We’re creating a project based on the template to give us a controller as we’ll inject our dependency into it later, otherwise we would have to create those. In a real project we might start with an empty template and create our own controllers from scratch (again, demo land, remember?).&lt;/p&gt;  &lt;p&gt;Once you do that you’ll be at the Hello World project of the MVC world.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://weblogs.asp.net/blogs/bsimser/image_5D413D7D.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://weblogs.asp.net/blogs/bsimser/image_thumb_436D074E.png" width="247" height="258" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Okay, now we’re going to install two NuGet packages, &lt;a href="http://www.ninject.org/"&gt;Ninject&lt;/a&gt; and &lt;a href="http://nlog-project.org/"&gt;NLog&lt;/a&gt;. Ninject is an open source dependency injection framework and makes working with external dependencies (like infrastructure and services) a breeze. NLog is a free logging solution for .NET and allows you to write anything to almost any target including files, event logs, web services, mail, forms. You name it, it can write to it. I was using log4net for all my projects but lately I’ve switched over to NLog. It’s super-simple to use and highly flexible. Did I mention it’s available as a NuGet package?&lt;/p&gt;  &lt;p&gt;Right click on the References in your project and choose Manage NuGet Packages…&lt;/p&gt;  &lt;p&gt;&lt;a href="http://weblogs.asp.net/blogs/bsimser/image_4294A164.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://weblogs.asp.net/blogs/bsimser/image_thumb_28C06B35.png" width="350" height="206" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Make sure you’re looking at the Online packages (sometimes the dialog will open up to installed packages or updatable ones). Type in “nlog” into the search box and you’ll see the filtered search results. Choose NLog Configuration from the options. If you already had a log configuration file you can just choose NLog to install the logger but since we’re starting from scratch we need a config file to start with. Selecting NLog Configuration and you’ll see it has a dependency on NLog so you can just install the one package which installs a starter config file and then drags along the library with it. Easy.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://weblogs.asp.net/blogs/bsimser/image_60FEE24D.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://weblogs.asp.net/blogs/bsimser/image_thumb_5FBA496E.png" width="502" height="335" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Once you’ve installed NLog you can enter “ninject” in the search box. This will bring up a list of packages for the dependency injection library Ninject by Nate Kohari. You’ll want to install the Ninject.MVC3 package by Remo Gloor and Ian Davis. This package will install Ninject itself and the extensions for MVC 3 (along with the bootstrapper for web projects. Ninject requires you to review and accept the license agreement before it will install so go ahead and do that.&lt;/p&gt;  &lt;p&gt;Two packages and all of their dependencies but you’re now only a few minutes (yes, minutes) away from dependency injection heaven and MVC 3.&lt;/p&gt;  &lt;p&gt;The first thing we’re going to do is create an interface that will be our logging system. We have a logger (NLog) but that’s an implementation and while we could scatter NLog statements all over the place, we would be tied directly to that library. If we decided to phase out NLog and replace it with another library (such as how I’ve shifted from log4net to NLog) we would have to go through everywhere in our code and replace the NLog calls with the next best thing.&lt;/p&gt;  &lt;p&gt;This the one of the principles of dependency injection, abstraction, and SOLID. Creating an abstraction of an implementation to code against without tying ourselves to any one system (so to speak). At the end of the day we’ll still be calling into NLog functions but we’ll be doing it through an implementation class via our interface.&lt;/p&gt;  &lt;p&gt;The other key thing about this approach is that we we can mock or stub out the actual implementation of our logger for unit testing. You can really do that (very well) with concrete implementations. Imagine having to start up a database, file system logger, and the Windows Event log service just to unit test some business code.&lt;/p&gt;  &lt;p&gt;In addition to being able to test our code, we can also code to interfaces meaning that we don’t need the actual implementation until it comes time to actually perform the work. For example the project I’m currently working on is going to require to call out to web services and databases. These components are not built yet and won’t be for another month or so. I don’t want to halt the development of my app so I create service interfaces and repositories that will abstract these away from my system, allowing me to build a fully working (and tested) system (which just happens to use hard coded values for now). Later when those services appear I just build an implementation to talk to them and voila, my system is still working exactly the way it does today.&lt;/p&gt;  &lt;p&gt;Okay, enough talk. Here’s the interface for our logging system. I’m borrowing from Rob’s approach by creating a folder called Infrastructure with a subfolder called Logging. In it I’ll create an ILogger interface that will let me write an information message (most logging systems have various levels of logging like Information, Warning, Errors, etc.)&lt;/p&gt;  &lt;p&gt;&lt;a href="http://weblogs.asp.net/blogs/bsimser/image_5E75B08F.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://weblogs.asp.net/blogs/bsimser/image_thumb_56EA4122.png" width="167" height="59" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;And here’s my ILogger interface:&lt;/p&gt;  &lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;   &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;     &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum1"&gt;   1:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;namespace&lt;/span&gt; MvcStarter.Infrastructure.Logging&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum2"&gt;   2:&lt;/span&gt; {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum3"&gt;   3:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;interface&lt;/span&gt; ILogger&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum4"&gt;   4:&lt;/span&gt;     {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum5"&gt;   5:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; Info(&lt;span style="color: #0000ff"&gt;string&lt;/span&gt; message);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum6"&gt;   6:&lt;/span&gt;     }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum7"&gt;   7:&lt;/span&gt; }&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;Next we need an implementation. We’ll create one for NLog. This is a simple class that implements ILogger and provides the Info method (along with the setup needed for NLog to work). Here’s the NLogLogger class:&lt;/p&gt;

&lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; height: 240px; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;
  &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;
    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum1"&gt;   1:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;using&lt;/span&gt; NLog;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum2"&gt;   2:&lt;/span&gt;  &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum3"&gt;   3:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;namespace&lt;/span&gt; MvcStarter.Infrastructure.Logging&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum4"&gt;   4:&lt;/span&gt; {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum5"&gt;   5:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; NLogLogger : ILogger&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum6"&gt;   6:&lt;/span&gt;     {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum7"&gt;   7:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;private&lt;/span&gt; Logger _logger;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum8"&gt;   8:&lt;/span&gt;  &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum9"&gt;   9:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; NLogLogger()&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum10"&gt;  10:&lt;/span&gt;         {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum11"&gt;  11:&lt;/span&gt;             _logger = LogManager.GetCurrentClassLogger();&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum12"&gt;  12:&lt;/span&gt;         }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum13"&gt;  13:&lt;/span&gt;  &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum14"&gt;  14:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; Info(&lt;span style="color: #0000ff"&gt;string&lt;/span&gt; message)&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum15"&gt;  15:&lt;/span&gt;         {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum16"&gt;  16:&lt;/span&gt;             _logger.Info(message);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum17"&gt;  17:&lt;/span&gt;         }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum18"&gt;  18:&lt;/span&gt;     }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum19"&gt;  19:&lt;/span&gt; }&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;We create a private variable of type NLog.Logger and create it in our constructor using the LogManager from NLog. Then to write using NLog we just call the Info method on the class, passing it our message.&lt;/p&gt;

&lt;p&gt;There are a lot of other methods we can call and add to our interface so later maybe we’ll extend that but this is enough to get you started.&lt;/p&gt;

&lt;p&gt;One more thing is that the default config file that was installed with the package is just that, blank. You need to tell it at least what target to use and what rules to apply to each target. The entire config file is documented online but you can just uncomment the sample implementation. Make sure to match up the logger rule (Trace in the config file) with your method you’re calling in the implementation. I just changed the minLevel of the NLog config file from Trace to Info to match our code.&lt;/p&gt;

&lt;p&gt;That’s all you need to have logging working but how do we call it? And how does Ninject fit in?&lt;/p&gt;

&lt;p&gt;Back when we installed Ninject it created a file for us. Go back to your project and check out the App_Start folder. Expand it and you’ll see a new file there called NinjectWebCommon.cs&lt;/p&gt;

&lt;p&gt;&lt;a href="http://weblogs.asp.net/blogs/bsimser/image_4B5483E3.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://weblogs.asp.net/blogs/bsimser/image_thumb_5CC4E4BB.png" width="227" height="112" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This sucker is responsible for kickstarting Ninject for you. If you watched Rob’s video or saw some tutorials on the net they talk about changing the base HttpApplication to a Ninject one. That’s one approach but with MVC 3 and the NuGet package this way is much simpler. There’s nothing for you to do except tell Ninject what dependencies you want to deal with and how to resolve them. &lt;/p&gt;

&lt;p&gt;Open up NinjectWebCommon.cs and scroll down to the RegisterServices method. This is where you’ll specify you own interfaces and concrete classes so Ninject can do it’s magic.&lt;/p&gt;



















&lt;p&gt;With a single line we’re going to tell Ninject this:&lt;/p&gt;

&lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;
  &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;
    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum1"&gt;   1:&lt;/span&gt; &lt;span style="color: #008000"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum2"&gt;   2:&lt;/span&gt; &lt;span style="color: #008000"&gt;/// Load your modules or register your services here!&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum3"&gt;   3:&lt;/span&gt; &lt;span style="color: #008000"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum4"&gt;   4:&lt;/span&gt; &lt;span style="color: #008000"&gt;/// &amp;lt;param name=&amp;quot;kernel&amp;quot;&amp;gt;The kernel.&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum5"&gt;   5:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;private&lt;/span&gt; &lt;span style="color: #0000ff"&gt;static&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; RegisterServices(IKernel kernel)&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum6"&gt;   6:&lt;/span&gt; {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum7"&gt;   7:&lt;/span&gt;     kernel.Bind&amp;lt;ILogger&amp;gt;().To&amp;lt;NLogLogger&amp;gt;().InSingletonScope();&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum8"&gt;   8:&lt;/span&gt; }        &lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;



&lt;p&gt;What are we saying here? Simple. We’re telling Ninject to:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Whenever you see the ILogger interface needed (e.g. passed into a constructor of a class)&lt;/li&gt;

  &lt;li&gt;Resolve to the NLogLogger class&lt;/li&gt;

  &lt;li&gt;Make it a singleton (i.e. only do it once and reuse it over and over again)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;We’re making our logger a singleton because we don’t need to start NLog every time we want to log a message. You can also specify other scopes (like by thread or on demand) but for logging a singleton works.&lt;/p&gt;

&lt;p&gt;Oh yeah, that’s it to hook up your dependency injection engine. And logging is ready to go.&lt;/p&gt;

&lt;p&gt;Let’s give it a whirl. Crack open the HomeController class and add a constructor that takes in an ILogger interface then using that interface, write out a message when the Index method is called (i.e. our home page is visited). Here’s the modified HomeController class:&lt;/p&gt;

&lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; height: 280px; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;
  &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;
    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum1"&gt;   1:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;using&lt;/span&gt; System.Web.Mvc;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum2"&gt;   2:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;using&lt;/span&gt; MvcStarter.Infrastructure.Logging;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum3"&gt;   3:&lt;/span&gt;&amp;#160; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum4"&gt;   4:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;namespace&lt;/span&gt; MvcStarter.Controllers&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum5"&gt;   5:&lt;/span&gt; {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum6"&gt;   6:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; HomeController : Controller&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum7"&gt;   7:&lt;/span&gt;     {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum8"&gt;   8:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;private&lt;/span&gt; &lt;span style="color: #0000ff"&gt;readonly&lt;/span&gt; ILogger _logger;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum9"&gt;   9:&lt;/span&gt;&amp;#160; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum10"&gt;  10:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; HomeController(ILogger logger)&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum11"&gt;  11:&lt;/span&gt;         {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum12"&gt;  12:&lt;/span&gt;             _logger = logger;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum13"&gt;  13:&lt;/span&gt;         }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum14"&gt;  14:&lt;/span&gt;&amp;#160; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum15"&gt;  15:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; ActionResult Index()&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum16"&gt;  16:&lt;/span&gt;         {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum17"&gt;  17:&lt;/span&gt;             ViewBag.Message = &lt;span style="color: #006080"&gt;&amp;quot;Welcome to ASP.NET MVC!&amp;quot;&lt;/span&gt;;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum18"&gt;  18:&lt;/span&gt;             _logger.Info(&lt;span style="color: #006080"&gt;&amp;quot;Home page visited&amp;quot;&lt;/span&gt;);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum19"&gt;  19:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; View();&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum20"&gt;  20:&lt;/span&gt;         }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum21"&gt;  21:&lt;/span&gt;&amp;#160; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum22"&gt;  22:&lt;/span&gt;         &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; ActionResult About()&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum23"&gt;  23:&lt;/span&gt;         {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum24"&gt;  24:&lt;/span&gt;             &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; View();&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum25"&gt;  25:&lt;/span&gt;         }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum26"&gt;  26:&lt;/span&gt;     }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum27"&gt;  27:&lt;/span&gt; }&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;We add an ILogger interface to the constructor. This trigger Ninject to figure out what implementation to grab (our NLogLogger one) and create it for us (or reuse it since we told it we wanted a singleton). Then we use that implementation in our Index() method to log a message.&lt;/p&gt;

&lt;p&gt;Compile and run the app to visit the home page of your app and you’ll see this in your log:&lt;/p&gt;

&lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;
  &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;
    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum1"&gt;   1:&lt;/span&gt; 2012-05-15 19:18:38.8471 INFO Home page visited&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;That’s it. You have a logging system you can call anytime (just inject the interface into the class, Ninject will take care of the rest) and your project is setup with dependency injection and you’re ready to go. Now you can just add additional interfaces as you need them.&lt;/p&gt;

&lt;p&gt;The awesome thing here is that a) you can now mock or stub out your logging implementation and test it and b) replace that implementation with some other logger any time and your code will still just work.&lt;/p&gt;

&lt;p&gt;That’s the power of dependency injection.&lt;/p&gt;

&lt;p&gt;As a bonus piece of information, now that you have the dependency injection setup you can use it any time in case you’re in a pinch and don’t need/want to inject the implementation into your class.&lt;/p&gt;

&lt;p&gt;Here’s how you can call the logger from your Application_Start method (found in Global.asax.cs) before any controllers are fired up:&lt;/p&gt;

&lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;
  &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;
    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum1"&gt;   1:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;protected&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; Application_Start()&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum2"&gt;   2:&lt;/span&gt; {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum3"&gt;   3:&lt;/span&gt;     AreaRegistration.RegisterAllAreas();&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum4"&gt;   4:&lt;/span&gt;&amp;#160; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum5"&gt;   5:&lt;/span&gt;     RegisterGlobalFilters(GlobalFilters.Filters);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum6"&gt;   6:&lt;/span&gt;     RegisterRoutes(RouteTable.Routes);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum7"&gt;   7:&lt;/span&gt;&amp;#160; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum8"&gt;   8:&lt;/span&gt;     DependencyResolver.Current.GetService&amp;lt;ILogger&amp;gt;().Info(&lt;span style="color: #006080"&gt;&amp;quot;Application Started&amp;quot;&lt;/span&gt;);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum9"&gt;   9:&lt;/span&gt; }&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;See that last line? DependencyResolver.Current.GetService will use whatever IoC you have configured and return the implementation of that interface.&lt;/p&gt;

&lt;p&gt;Okay, that’s enough to get started. Again, I encourage you to watch Rob’s *entire* video of setting up a new MVC project. Even though the video is for MVC 2, there are still a lot of idea that hold water in MVC 3 and it’s a great learning too (and free too).&lt;/p&gt;

&lt;p&gt;Enjoy!&lt;/p&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=8484043" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/bsimser/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://weblogs.asp.net/bsimser/archive/tags/MVC/default.aspx">MVC</category><category domain="http://weblogs.asp.net/bsimser/archive/tags/NuGet/default.aspx">NuGet</category><category domain="http://weblogs.asp.net/bsimser/archive/tags/Visual+Studio/default.aspx">Visual Studio</category></item><item><title>Configure Email notifications on SharePoint 2010 list</title><link>http://weblogs.asp.net/sreejukg/archive/2012/05/15/configure-email-notifications-on-sharepoint-2010-list.aspx</link><pubDate>Tue, 15 May 2012 19:58:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:8482567</guid><dc:creator>sreejukg</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;In this article I am going to demonstrate how you can configure email notification feature on SharePoint List. For the purpose of demonstration I chose the default tasks list that is coming with almost all default SharePoint sites. Tasks list have one column “Assigned To”. When an item is created in the task list, I would like to send an email to the user to whom the task is assigned. The scenario is very simple and straight forward. &lt;/p&gt;  &lt;p&gt;In order to perform certain action when an Item is created in a list, you can make use of Workflow. To understand more about workflows in SharePoint 2010, refer the link &lt;a href="http://technet.microsoft.com/en-us/sharepoint/ff819861" mce_href="http://technet.microsoft.com/en-us/sharepoint/ff819861"&gt;http://technet.microsoft.com/en-us/sharepoint/ff819861&lt;/a&gt; . &lt;/p&gt;  &lt;p&gt;So What I need to do is to create a list workflow that is associated with my Tasks list. The workflow should be initiated automatically whenever an item is added to the tasks list. I am going to use SharePoint Designer as the workflow authoring tool. &lt;/p&gt;  &lt;p&gt;Open SharePoint designer and open the site where your tasks list resides. Click on File menu, then select Add Item from the Menu. Under the workflow section, select List Workflow &lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;a href="http://weblogs.asp.net/blogs/sreejukg/clip_image001_1ACC4236.png" mce_href="http://weblogs.asp.net/blogs/sreejukg/clip_image001_1ACC4236.png"&gt;&lt;img src="http://weblogs.asp.net/blogs/sreejukg/clip_image001_thumb_5A56532E.png" style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="clip_image001" alt="clip_image001" mce_src="http://weblogs.asp.net/blogs/sreejukg/clip_image001_thumb_5A56532E.png" border="0" height="241" width="244"&gt;&lt;/a&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Now SharePoint designer will ask you to enter a name for your workflow. Also select a list to which the workflow will be applied. Since I am going to create a workflow on task list, I have selected it and for the purpose of this demonstration I have named the workflow as “MyTaskFlow”. Click on create button once you are done.&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;a href="http://weblogs.asp.net/blogs/sreejukg/clip_image003_58C5114D.jpg" mce_href="http://weblogs.asp.net/blogs/sreejukg/clip_image003_58C5114D.jpg"&gt;&lt;img src="http://weblogs.asp.net/blogs/sreejukg/clip_image003_thumb_6CAE7E16.jpg" style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="clip_image003" alt="clip_image003" mce_src="http://weblogs.asp.net/blogs/sreejukg/clip_image003_thumb_6CAE7E16.jpg" border="0" height="121" width="244"&gt;&lt;/a&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;SharePoint Designer will open the Workflow in the workflow editor. The default workflow screen will look similar to the following. &lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;a href="http://weblogs.asp.net/blogs/sreejukg/clip_image005_24148F45.jpg" mce_href="http://weblogs.asp.net/blogs/sreejukg/clip_image005_24148F45.jpg"&gt;&lt;img src="http://weblogs.asp.net/blogs/sreejukg/clip_image005_thumb_71810C05.jpg" style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="clip_image005" alt="clip_image005" mce_src="http://weblogs.asp.net/blogs/sreejukg/clip_image005_thumb_71810C05.jpg" border="0" height="117" width="244"&gt;&lt;/a&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;In our case the workflow is simple; we just need to add a step that will send email. In real life you may need to check certain condition, for e.g. if the task priority is high, then send email etc. When sending email, the workflow should access the data from the created item such as who created it and to whom it is assigned etc. You can add conditions and actions to workflow. In our case, it is just one action. Click on the Action Icon in the top and select send email. &lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;a href="http://weblogs.asp.net/blogs/sreejukg/clip_image006_2BFC0BDA.png" mce_href="http://weblogs.asp.net/blogs/sreejukg/clip_image006_2BFC0BDA.png"&gt;&lt;img src="http://weblogs.asp.net/blogs/sreejukg/clip_image006_thumb_4EDCCD8A.png" style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="clip_image006" alt="clip_image006" mce_src="http://weblogs.asp.net/blogs/sreejukg/clip_image006_thumb_4EDCCD8A.png" border="0" height="86" width="145"&gt;&lt;/a&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;When you click on Action icon, it will pop up all the available actions that you can choose from. There are many actions available and we need send an Email Action.&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;a href="http://weblogs.asp.net/blogs/sreejukg/clip_image007_4E0467A0.png" mce_href="http://weblogs.asp.net/blogs/sreejukg/clip_image007_4E0467A0.png"&gt;&lt;img src="http://weblogs.asp.net/blogs/sreejukg/clip_image007_thumb_36991795.png" style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="clip_image007" alt="clip_image007" mce_src="http://weblogs.asp.net/blogs/sreejukg/clip_image007_thumb_36991795.png" border="0" height="244" width="149"&gt;&lt;/a&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;When you choose the Action, it will be inserted in the Step. Also you can simply type in the Step where underline is there to pick the right action/condition. This is another way of authoring if you don’t want to use mouse and menu to pick the actions/conditions. The default Send Email action will look similar to following. &lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;a href="http://weblogs.asp.net/blogs/sreejukg/clip_image008_40DA1628.png" mce_href="http://weblogs.asp.net/blogs/sreejukg/clip_image008_40DA1628.png"&gt;&lt;img src="http://weblogs.asp.net/blogs/sreejukg/clip_image008_thumb_3E50E46A.png" style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="clip_image008" alt="clip_image008" mce_src="http://weblogs.asp.net/blogs/sreejukg/clip_image008_thumb_3E50E46A.png" border="0" height="76" width="244"&gt;&lt;/a&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Click on users link, it will bring Define email dialog. Here you need to select address, subject and a body for the email. &lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;a href="http://weblogs.asp.net/blogs/sreejukg/clip_image009_71ACA7C6.png" mce_href="http://weblogs.asp.net/blogs/sreejukg/clip_image009_71ACA7C6.png"&gt;&lt;img src="http://weblogs.asp.net/blogs/sreejukg/clip_image009_thumb_3DD48BA8.png" style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="clip_image009" alt="clip_image009" mce_src="http://weblogs.asp.net/blogs/sreejukg/clip_image009_thumb_3DD48BA8.png" border="0" height="225" width="244"&gt;&lt;/a&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;First you need to enter the To address. Click on the browser button next to To: text box. Here you can add a static email address or you can pick it from SharePoint objects. As our requirement is to send to the user in the Assigned To field, you have an option to pick this data from the current Item property. First select Workflow lookup for a user, click on the Add button.&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&amp;nbsp;&lt;a href="http://weblogs.asp.net/blogs/sreejukg/clip_image010_0EC22A04.png" mce_href="http://weblogs.asp.net/blogs/sreejukg/clip_image010_0EC22A04.png"&gt;&lt;img src="http://weblogs.asp.net/blogs/sreejukg/clip_image010_thumb_4A7E705F.png" style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="clip_image010" alt="clip_image010" mce_src="http://weblogs.asp.net/blogs/sreejukg/clip_image010_thumb_4A7E705F.png" border="0" height="225" width="244"&gt;&lt;/a&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;This will bring the lookup dialog to select the item and field. Also make sure you select return field as Email Address. &lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;a href="http://weblogs.asp.net/blogs/sreejukg/clip_image011_25510026.png" mce_href="http://weblogs.asp.net/blogs/sreejukg/clip_image011_25510026.png"&gt;&lt;img src="http://weblogs.asp.net/blogs/sreejukg/clip_image011_thumb_02F8A906.png" style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="clip_image011" alt="clip_image011" mce_src="http://weblogs.asp.net/blogs/sreejukg/clip_image011_thumb_02F8A906.png" border="0" height="224" width="244"&gt;&lt;/a&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Click OK twice so the select users dialog will be closed. Now in the subject box, enter some text. You can even pick the data from current item such as showing the task title in the subject. In the body part, you need to tell the user “the task is created for you at &amp;lt;time of the task&amp;gt; by &amp;lt;created user&amp;gt;. So you need to access the item properties in the body too. You can see Add/change lookup button in the bottom of the dialog to pick the necessary fields. You can write custom message and include the fields in between the message as necessary. Below is the screenshot of the email body I have configured.&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&amp;nbsp;&lt;a href="http://weblogs.asp.net/blogs/sreejukg/clip_image012_64120F5A.png" mce_href="http://weblogs.asp.net/blogs/sreejukg/clip_image012_64120F5A.png"&gt;&lt;img src="http://weblogs.asp.net/blogs/sreejukg/clip_image012_thumb_799C222A.png" style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="clip_image012" alt="clip_image012" mce_src="http://weblogs.asp.net/blogs/sreejukg/clip_image012_thumb_799C222A.png" border="0" height="224" width="244"&gt;&lt;/a&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Click OK once you are done. Now you can see the start options for the workflow as follows. &lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;a href="http://weblogs.asp.net/blogs/sreejukg/clip_image013_791FC968.png" mce_href="http://weblogs.asp.net/blogs/sreejukg/clip_image013_791FC968.png"&gt;&lt;img src="http://weblogs.asp.net/blogs/sreejukg/clip_image013_thumb_57C023CC.png" style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="clip_image013" alt="clip_image013" mce_src="http://weblogs.asp.net/blogs/sreejukg/clip_image013_thumb_57C023CC.png" border="0" height="65" width="244"&gt;&lt;/a&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Since I want the workflow to start automatically when an Item is created I selected the second option. Now I need to publish it. To publish the workflow, press on the publish button in the top.&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;a href="http://weblogs.asp.net/blogs/sreejukg/clip_image014_411DD585.png" mce_href="http://weblogs.asp.net/blogs/sreejukg/clip_image014_411DD585.png"&gt;&lt;img src="http://weblogs.asp.net/blogs/sreejukg/clip_image014_thumb_4CD31CB7.png" style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="clip_image014" alt="clip_image014" mce_src="http://weblogs.asp.net/blogs/sreejukg/clip_image014_thumb_4CD31CB7.png" border="0" height="129" width="243"&gt;&lt;/a&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Now when you go to your list, you will see the workflow is available under the list you configured the workflow, in our case under the Tasks list. From the browser, go to the tasks list, then open list tab.&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;a href="http://weblogs.asp.net/blogs/sreejukg/clip_image016_138C8FF5.jpg" mce_href="http://weblogs.asp.net/blogs/sreejukg/clip_image016_138C8FF5.jpg"&gt;&lt;img src="http://weblogs.asp.net/blogs/sreejukg/clip_image016_thumb_5D5AF1D8.jpg" style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="clip_image016" alt="clip_image016" mce_src="http://weblogs.asp.net/blogs/sreejukg/clip_image016_thumb_5D5AF1D8.jpg" border="0" height="103" width="244"&gt;&lt;/a&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;On the right corner, you can see workflow settings link&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;a href="http://weblogs.asp.net/blogs/sreejukg/clip_image017_30D1C1F2.png" mce_href="http://weblogs.asp.net/blogs/sreejukg/clip_image017_30D1C1F2.png"&gt;&lt;img src="http://weblogs.asp.net/blogs/sreejukg/clip_image017_thumb_77F76824.png" style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="clip_image017" alt="clip_image017" mce_src="http://weblogs.asp.net/blogs/sreejukg/clip_image017_thumb_77F76824.png" border="0" height="63" width="244"&gt;&lt;/a&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;blockquote&gt;   &lt;p&gt;Click on the Workflow Settings link, this will open the workflow settings for the tasks list and you can find our workflow is available in the list. &lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;a href="http://weblogs.asp.net/blogs/sreejukg/clip_image019_22EF562A.jpg" mce_href="http://weblogs.asp.net/blogs/sreejukg/clip_image019_22EF562A.jpg"&gt;&lt;img src="http://weblogs.asp.net/blogs/sreejukg/clip_image019_thumb_31D68544.jpg" style="border-width: 0px; border-style: none; border-color: -moz-use-text-color; display: inline;" title="clip_image019" alt="clip_image019" mce_src="http://weblogs.asp.net/blogs/sreejukg/clip_image019_thumb_31D68544.jpg" border="0" height="77" width="244"&gt;&lt;/a&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Now go and add a new list item and you will see the workflow will be executed automatically and will send email. Designing such business processes is simple and straight forward with SharePoint 2010 and SharePoint Designer. Without writing single line of code you can achieve your day to day business requirements. &lt;/p&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=8482567" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/sreejukg/archive/tags/Sharepoint/default.aspx">Sharepoint</category><category domain="http://weblogs.asp.net/sreejukg/archive/tags/SharePoint+2010/default.aspx">SharePoint 2010</category><category domain="http://weblogs.asp.net/sreejukg/archive/tags/Sharepoint+Designer/default.aspx">Sharepoint Designer</category></item><item><title>Video Training - Android Advanced Development Using Mono for Android 4</title><link>http://weblogs.asp.net/wallym/archive/2012/05/15/video-training-android-advanced-development-using-mono-for-android-4.aspx</link><pubDate>Tue, 15 May 2012 14:15:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:8480855</guid><dc:creator>Wallym</dc:creator><slash:comments>0</slash:comments><description>&lt;a href="http://www.learnmobilenow.com/Topic.aspx?id=207" mce_href="http://www.learnmobilenow.com/Topic.aspx?id=207" target="_new"&gt;This course is about how to use Mono for Android with Tablets and the new Android 4.0 Ice Cream Sandwich release&lt;/a&gt;. The course introduces Android Tablets and Fragments, new controls that are available through Android 4.0, new application programming interfaces in Android 4.0, and new features available in the Google Android SDK Release 17 that can improve their development experience. This course also contains a module on the Android Design Experience, what developers can use to improve the user experiences, design suggestions from Google’s Android team, and some thoughts on how to improve the design experience via software code.&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=8480855" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/wallym/archive/tags/android/default.aspx">android</category><category domain="http://weblogs.asp.net/wallym/archive/tags/Community+News/default.aspx">Community News</category><category domain="http://weblogs.asp.net/wallym/archive/tags/mono+for+android/default.aspx">mono for android</category></item><item><title>"An error occurred when verifying security for the message." when executing .SaveChanges()</title><link>http://weblogs.asp.net/pabloperalta/archive/2012/05/14/quot-an-error-occurred-when-verifying-security-for-the-message-quot-when-executing-savechanges.aspx</link><pubDate>Mon, 14 May 2012 22:58:03 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:8478160</guid><dc:creator>pablop</dc:creator><slash:comments>2</slash:comments><description>&lt;div class="wlWriterHeaderFooter" style="float:none; margin:0px; padding:4px 0px 4px 0px;"&gt;&lt;iframe src="http://www.facebook.com/widgets/like.php?href=http://weblogs.asp.net/pabloperalta/archive/2012/05/14/quot-an-error-occurred-when-verifying-security-for-the-message-quot-when-executing-savechanges.aspx" scrolling="no" frameborder="0" style="border:none; width:450px; height:80px"&gt;&lt;/iframe&gt;&lt;/div&gt;&lt;p&gt;Hi, &lt;/p&gt;  &lt;p&gt;I have just came across this exception when trying to execute the &lt;strong&gt;SaveChanges&lt;/strong&gt;() method of my &lt;strong&gt;ServiceContext&lt;/strong&gt; object in CRM 2011 (on-premise).&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Exception:&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#ff0000"&gt;&amp;quot;An unsecured or incorrectly secured fault was received from the other party. See the inner FaultException for the fault code and detail.&amp;quot;&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Inner Exception:&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;&amp;quot;&lt;font color="#ff0000"&gt;&lt;strong&gt;An error occurred when verifying security for the message.&amp;quot;&lt;/strong&gt;&lt;/font&gt; &lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Unfortunately I couldn’t find so much useful information around about the InnerException, which I guess should be the first thing to search for. But, I did could find related info about the main Exception and realized that I was also having troubles to connect from my CRM Outlook client too. So, I suspected that it was something wrong with my machine but not the code, the code was right.&lt;/p&gt;  &lt;p&gt;And that was true. &lt;font color="#0000ff"&gt;&lt;strong&gt;The problem was my clock&lt;/strong&gt;&lt;/font&gt;. As I have changed my time zone, time was not in synch with my CRM 2011 server.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;h2&gt;Solution:&lt;/h2&gt;  &lt;p&gt;In my case, &lt;font color="#0000ff"&gt;I just set up same time zone in my machine as the server is set up, adjusted the clock, F5 again and voila!&lt;/font&gt; SaveChanges() worked like a charm &lt;img style="border-bottom-style: none; border-left-style: none; border-top-style: none; border-right-style: none" class="wlEmoticon wlEmoticon-smile" alt="Smile" src="http://weblogs.asp.net/blogs/pabloperalta/wlEmoticon-smile_6FFFF6E7.png" /&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Hope it helps to save somebody else’s time,&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;PP&lt;/strong&gt; [twitter: &lt;a href="http://twitter.com/pabloperalta" target="_blank"&gt;@pabloperalta&lt;/a&gt;]&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.uruitdynamix.com/"&gt;UruIT Dynamix&lt;/a&gt; | Excellence in Dynamics CRM Nearshoring Services.&lt;/p&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=8478160" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/pabloperalta/archive/tags/crm+2011/default.aspx">crm 2011</category><category domain="http://weblogs.asp.net/pabloperalta/archive/tags/dynamics+crm/default.aspx">dynamics crm</category><category domain="http://weblogs.asp.net/pabloperalta/archive/tags/dynamics+crm+2011/default.aspx">dynamics crm 2011</category><category domain="http://weblogs.asp.net/pabloperalta/archive/tags/visual+studio/default.aspx">visual studio</category><category domain="http://weblogs.asp.net/pabloperalta/archive/tags/xrm/default.aspx">xrm</category></item><item><title>CI Deployments To IIS VIA MS Web Deploy 2.0</title><link>http://weblogs.asp.net/srkirkland/archive/2012/05/14/ci-deployments-to-iis-via-ms-web-deploy-2-0.aspx</link><pubDate>Mon, 14 May 2012 18:15:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:8462339</guid><dc:creator>srkirkland</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;&lt;font size="2"&gt;Now that I have my source code being checked into &lt;/font&gt;&lt;a href="https://github.com/" target="_blank"&gt;&lt;font size="2"&gt;GitHub&lt;/font&gt;&lt;/a&gt;&lt;font size="2"&gt; and have &lt;/font&gt;&lt;a href="http://www.jetbrains.com/teamcity/" target="_blank"&gt;&lt;font size="2"&gt;TeamCity&lt;/font&gt;&lt;/a&gt;&lt;font size="2"&gt; doing automatic builds (and running tests), I thought it was about time to take the last big step &lt;/font&gt;&lt;font size="2"&gt;and automatically deploy the latest version of an application to a live site (either for testing or just straight to production, it’s up to you) whenever a successful build has taken place.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="2"&gt;The best resource I’ve found for deploying directly from TeamCity (note: the steps would be the same for any CI server) can be found in Troy Hunt’s excellent 5 part blog series here: &lt;a href="http://www.troyhunt.com/2010/11/you-deploying-it-wrong-teamcity.html"&gt;http://www.troyhunt.com/2010/11/you-deploying-it-wrong-teamcity.html&lt;/a&gt;.&amp;#160; It is very comprehensive and well worth a read, but I had some issues configuring deployment permissions and wanted to detail them here in case it helps someone else down the road.&lt;/font&gt;&lt;/p&gt;  &lt;h3&gt;&lt;u&gt;An Overview Of the CI Deployment Process&lt;/u&gt;&lt;/h3&gt;  &lt;p&gt;&lt;font size="2"&gt;Here’s a basic idea of how to get started—if you’ve ever used the Visual Studio 2010 “Publish” wizard then you are 1/2 way there.&amp;#160; If you have any questions on these steps, refer to &lt;/font&gt;&lt;a href="http://www.troyhunt.com/2010/11/you-deploying-it-wrong-teamcity.html" target="_blank"&gt;&lt;font size="2"&gt;the blog series mentioned above&lt;/font&gt;&lt;/a&gt;&lt;font size="2"&gt; or Google with Bing for help.&lt;/font&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;font size="2"&gt;Install Microsoft Web Deploy 2.0 from &lt;/font&gt;&lt;a href="http://www.iis.net/download/webdeploy"&gt;&lt;font size="2"&gt;http://www.iis.net/download/webdeploy&lt;/font&gt;&lt;/a&gt;&lt;font size="2"&gt; on the server you wish to publish to.&lt;/font&gt; &lt;/li&gt;    &lt;li&gt;&lt;font size="2"&gt;Setup Web.Config transformations for your desired build configurations (see &lt;/font&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/dd465318.aspx"&gt;&lt;font size="2"&gt;http://msdn.microsoft.com/en-us/library/dd465318.aspx&lt;/font&gt;&lt;/a&gt;&lt;font size="2"&gt;)&lt;/font&gt; &lt;/li&gt;    &lt;li&gt;&lt;font size="2"&gt;Inside Visual Studio, right click –&amp;gt; properties on your Web project, and under Package/Publish Web setup the IIS Web Application name to match your IIS server&lt;/font&gt;       &lt;ul&gt;       &lt;li&gt;&lt;font size="2"&gt;This is the virtual directory inside IIS that your deployment will be pushed to.&amp;#160; Set it up for each desired build configuration.&lt;/font&gt; &lt;/li&gt;     &lt;/ul&gt;   &lt;/li&gt;    &lt;li&gt;Setup Permissions on your IIS Server to allow web deployment from your CI agent or service account (detailed below). &lt;/li&gt;    &lt;li&gt;&lt;font size="2"&gt;Craft an MSBuild command that will build AND deploy your web application, and run it during your CI Server build process (also detailed below).&lt;/font&gt; &lt;/li&gt; &lt;/ul&gt;  &lt;h3&gt;&lt;u&gt;Deploying Via MSBuild&lt;/u&gt;&lt;/h3&gt;  &lt;p&gt;&lt;font size="2"&gt;That last point requires a bit of explanation as it’s the crux of the problem (other than permissions, which I’ll get to later).&amp;#160; What we want MSBuild to do here is to build your project/solution using the desired build configuration (like Debug/Release) and then to use the MS Web Deploy service to push your auto-created deployment package to IIS.&amp;#160; Here’s an example of MSBuild parameters from Troy’s blog that will accomplish this:&lt;/font&gt;&lt;/p&gt;  &lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;   &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;     &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;/P:Configuration=%env.Configuration%&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;/P:DeployOnBuild=True&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;/P:DeployTarget=MSDeployPublish&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;/P:MsDeployServiceUrl=https://%env.TargetServer%/MsDeploy.axd&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;/P:AllowUntrustedCertificate=True&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;/P:MSDeployPublishMethod=WMSvc&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;/P:CreatePackageOnPublish=True&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;/P:UserName=AutoDeploy\Administrator&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;/P:Password=Passw0rd&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;&lt;font size="2"&gt;&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="2"&gt;Basically the above parameters use the provided env.Configuration (Debug/Release) to set the build configuration and then tell MSBulid to deploy using WMSvc (web management service) to the service url located at env.TargetServer (you can set the defaults on your CI server).&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="2"&gt;This is pretty handy, but I unfortunately for me (and maybe for you) there are two problems here:&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="2"&gt;#1: The user (AutoDeploy\Administrator) needs to be an admin on your IIS, and you need to have allowed Administrators to bypass rules in the “Management Service Delegation” area of IIS (see ScottGu’s post here: &lt;a href="http://weblogs.asp.net/scottgu/archive/2010/09/13/automating-deployment-with-microsoft-web-deploy.aspx"&gt;http://weblogs.asp.net/scottgu/archive/2010/09/13/automating-deployment-with-microsoft-web-deploy.aspx&lt;/a&gt;).&amp;#160; For me, this is too much by itself.&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="2"&gt;#2: The username and password as passed in plain text through your configuration, as shown above. &lt;a href="http://www.nooooooooooooooo.com/" target="_blank"&gt;Not good&lt;/a&gt;.&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="2"&gt;The rest of this post will detail how to solve these issues, and in the end we will setup an service account that has non-admin access and which doesn’t require passing credentials manually.&lt;/font&gt;&lt;/p&gt;

&lt;h3&gt;&lt;u&gt;Setting Up the Service Account&lt;/u&gt;&lt;/h3&gt;

&lt;p&gt;&lt;font size="2"&gt;The first step is to create a non-admin service account that will be used on both your build server and IIS boxes. I’ll be using a no-login domain account called “mydomain\builderservice”, but any account would work.&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="2"&gt;On your CI server (in my case, TeamCity), you’ll want to run your build agent as your new service account, as shown here:&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="http://weblogs.asp.net/blogs/srkirkland/image_079E16CD.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://weblogs.asp.net/blogs/srkirkland/image_thumb_1497F6DE.png" width="640" height="245" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="2"&gt;Note you might also have to give this service access to certain files. For example, in TeamCity the build agent needs access to C:\TeamCity\buildAgent to do its work.&lt;/font&gt;&lt;/p&gt;

&lt;h3&gt;&lt;u&gt;Changing the MSBuild Script to Run As “Current User”&lt;/u&gt;&lt;/h3&gt;

&lt;p&gt;&lt;font size="2"&gt;This part was fairly tricky since simply removing the UserName/Password parameters from the msbuild command will not work as expected.&amp;#160; Instead you must specify the AuthType to be NTLM (or it will default to Basic) and the UserName=[blank] so it will impersonate the current user.&amp;#160; The relevant parameters are /P:UserName= /P:AuthType=NTLM.&amp;#160; This makes the final MSBuild parameters:&lt;/font&gt;&lt;/p&gt;

&lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;
  &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;
    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;/P:Configuration=%env.Configuration%&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;/P:DeployOnBuild=True &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;/P:DeployTarget=MSDeployPublish &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;/P:MsDeployServiceUrl=https://%env.TargetServer%/MsDeploy.axd&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;/P:AllowUntrustedCertificate=True &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;/P:MsDeployPublishMethod=WMSvc &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;/P:CreatePackageOnPublish=True &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;/P:UserName= &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;/P:AuthType=NTLM&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;&lt;font size="2"&gt;Now that we have TeamCity running MSBuild with these parameters while running under a service account, we need to grant permission on the IIS server that has MS Deploy installed (%env.TargetServer%).&lt;/font&gt;&lt;/p&gt;

&lt;h3&gt;&lt;u&gt;IIS Server Permission For Deployment&lt;/u&gt;&lt;/h3&gt;

&lt;p&gt;&lt;font size="2"&gt;Your mileage may vary, but in order to get a successful web deployment from a non-administrator account, I had to perform the following steps, each of which I will explain in detail.&lt;/font&gt;&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;&lt;font size="2"&gt;Enable Windows Authentication for the Web Management Server (WMSvc)&lt;/font&gt; &lt;/li&gt;

  &lt;li&gt;&lt;font size="2"&gt;Grant Management Service Delegation rights at the Site level to the necessary providers&lt;/font&gt; &lt;/li&gt;

  &lt;li&gt;&lt;font size="2"&gt;Grant IIS Manager Permissions to your virtual application&lt;/font&gt; &lt;/li&gt;

  &lt;li&gt;&lt;font size="2"&gt;Grant file/folder permissions to the web directory&lt;/font&gt; &lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;#1: &lt;font size="2"&gt;Enable Windows Authentication for the Web Management Server (WMSvc)&lt;/font&gt;&lt;/h3&gt;

&lt;p&gt;&lt;font size="2"&gt;In order to get the WMSvc to accept my build agent credentials, I had to enable Windows Authentication inside the IIS Management Service. You can do this either from the UI or Windows Registry as described in &lt;a href="http://stackoverflow.com/a/4834248" target="_blank"&gt;this stackoverflow post&lt;/a&gt;.&amp;#160; For convenience, here is the regex key (make sure to restart the WMSvc after making the change): ‘reg add HKLM\Software\Microsoft\WebManagement\Server /v WindowsAuthenticationEnabled /t REG_DWORD /d 1’&lt;/font&gt;&lt;/p&gt;

&lt;h3&gt;#2: &lt;font size="2"&gt;Grant Management Service Delegation rights at the Site level to the necessary providers&lt;/font&gt;&lt;/h3&gt;

&lt;p&gt;&lt;font size="2"&gt;Next you must Delegate to your service account the rights to perform certain actions through the management service providers. If you forget any of these you will get a helpful error message saying that you don’t have rights to run a certain provider (ex: “createApp”) so you’d then need to come back in and add those.&amp;#160; I needed the following providers: “contentPath, iisApp, createApp, setAcl.”&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="2"&gt;To set a delegation rule go to your site root in IIS and under Management choose “Management Service Delegation.”&amp;#160; Now choose “Add Rule” in the upper-right and choose the “Deploy Applications with Content” template (this has the best defaults) and then add in your desired providers. Mine looked like this:&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="http://weblogs.asp.net/blogs/srkirkland/image_6090061F.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://weblogs.asp.net/blogs/srkirkland/image_thumb_70BBCE18.png" width="345" height="532" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;font size="2"&gt;Click ok, and now that the rule is defined you just have to select the newly created rule and choose “Add User To Role.”&amp;#160; In the ensuing dialog enter the name of your service account and press OK.&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="http://weblogs.asp.net/blogs/srkirkland/image_0B87F425.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://weblogs.asp.net/blogs/srkirkland/image_thumb_63E177FA.png" width="235" height="202" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;#3: &lt;font size="2"&gt;Grant IIS Manager Permissions to your virtual application&lt;/font&gt;&lt;/h3&gt;

&lt;p&gt;&lt;font size="2"&gt;Now that you granted site-level provider access within the {userScope} path, you must give the account IIS permission on the site/application that you will be deploying to.&amp;#160; Choose your site and then under Management choose “IIS Manager Permissions.”&amp;#160; Now click “Allow User” and enter the account name again to grant access.&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="http://weblogs.asp.net/blogs/srkirkland/image_3BCEC8DB.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://weblogs.asp.net/blogs/srkirkland/image_thumb_41A96C74.png" width="373" height="216" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;#4: &lt;font size="2"&gt;Grant file/folder permissions to the web directory&lt;/font&gt;&lt;/h3&gt;

&lt;p&gt;&lt;font size="2"&gt;This one is pretty obvious, but you still have to remember to give full control to your service account at the OS-folder level (ex: C:\inetpub\SiteName).&amp;#160; Right-click –&amp;gt; Properties –&amp;gt; Security –&amp;gt; Edit, and then choose Add.&amp;#160; Now type in your service account one more time, grant it full control, and you are finished.&lt;/font&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="http://weblogs.asp.net/blogs/srkirkland/image_1996BD55.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://weblogs.asp.net/blogs/srkirkland/image_thumb_26246A71.png" width="395" height="425" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;&lt;u&gt;Celebrate!&lt;/u&gt;&lt;/h3&gt;

&lt;p&gt;That was certainly a lot of info, and I hope it makes someone’s deployment configuration easier.&amp;#160; Integrating your build, test, and deployments with a CI Server like TeamCity has many advantages, including the ability to handle “deploy automatically only when all tests pass” and “oops, deploy the version from last week” scenarios.&lt;/p&gt;

&lt;p&gt;May all your Deployments be green.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://weblogs.asp.net/blogs/srkirkland/image_04C4C4D5.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://weblogs.asp.net/blogs/srkirkland/image_thumb_6847D2F4.png" width="241" height="71" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Enjoy!&lt;/p&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=8462339" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/srkirkland/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://weblogs.asp.net/srkirkland/archive/tags/MSBuild/default.aspx">MSBuild</category><category domain="http://weblogs.asp.net/srkirkland/archive/tags/Visual+Studio/default.aspx">Visual Studio</category></item><item><title>Introducing Testing Domain - localtest.me</title><link>http://weblogs.asp.net/owscott/archive/2012/05/14/introducing-testing-domain-localtest-me.aspx</link><pubDate>Mon, 14 May 2012 15:59:54 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:8477060</guid><dc:creator>OWScott</dc:creator><slash:comments>13</slash:comments><description>&lt;p&gt;Save this URL, memorize it, write it on a sticky note, tweet it, tell your colleagues about it!&amp;#160; &lt;strong&gt;&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;&lt;font size="4"&gt;&lt;font color="#c0504d"&gt;localtest.me&lt;/font&gt; (&lt;/font&gt;&lt;a href="http://localtest.me"&gt;&lt;font size="4"&gt;http://localtest.me&lt;/font&gt;&lt;/a&gt;&lt;font size="4"&gt;)&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;and&lt;/p&gt;  &lt;p&gt;&lt;font size="4"&gt;&lt;font color="#c0504d"&gt;*.localtest.me&lt;/font&gt; (&lt;/font&gt;&lt;a href="http://something.localtest.me"&gt;&lt;font size="4"&gt;http://something.localtest.me&lt;/font&gt;&lt;/a&gt;&lt;font size="4"&gt;)&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;If you do any testing on your local system you’ve probably created &lt;em&gt;hosts &lt;/em&gt;file entries (c:\windows\system32\drivers\etc\hosts) for different testing domains and had them point back to 127.0.0.1.&amp;#160; This works great but it requires just a bit of extra effort. &lt;/p&gt;  &lt;p&gt;This localtest.me trick is so obvious, so simple, and yet so powerful.&amp;#160; I wouldn’t be surprised if there are other domain names like this out there, but I haven’t run across them yet so I just ordered the domain name &lt;em&gt;localtest.me&lt;/em&gt; which I’ll keep available for the internet community to use. &lt;/p&gt;  &lt;p&gt;Here’s how it works. The entire domain name localtest.me—and all wildcard entries—point to 127.0.0.1.&amp;#160; So without any changes to your host file you can immediate start testing with a local URL.&lt;/p&gt;  &lt;p&gt;Examples:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://localtest.me"&gt;http://localtest.me&lt;/a&gt;     &lt;br /&gt;&lt;a href="http://newyork.localtest.me"&gt;http://newyork.localtest.me&lt;/a&gt;     &lt;br /&gt;&lt;a href="http://mysite.localtest.me"&gt;http://mysite.localtest.me&lt;/a&gt;    &lt;br /&gt;&lt;a href="http://redirecttest.localtest.me"&gt;http://redirecttest.localtest.me&lt;/a&gt;     &lt;br /&gt;&lt;a href="http://sub1.sub2.sub3.localtest.me"&gt;http://sub1.sub2.sub3.localtest.me&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;You name it, just use any *.localtest.me URL that you dream up and it will work for testing on your local system.&lt;/p&gt;  &lt;p&gt;This was inspired by a trick that &lt;a href="http://imar.spaanjaars.com/"&gt;Imar Spaanjaars&lt;/a&gt; introduced me to. He created a loopback wildcard URL with his company domain name.&amp;#160; I took this one step further and ordered a domain name just for this purpose.&lt;/p&gt;  &lt;p&gt;I would have liked to order localhost.com or localhost.me but those domain names were taken. So to help you remember, just remember that it’s ‘local&lt;strong&gt;test&lt;/strong&gt;’ and not ‘localhost’, and it’s ‘.me’ rather than ‘.com’.&lt;/p&gt;  &lt;p&gt;I can’t track usage since the domain name resolves to 127.0.0.1 and never passes through my servers, so this is just a public tool which I’ll give to the community. I hope it gets used. And, since I can’t really use the domain name to explain itself, please spread the word and tell others about it.&lt;/p&gt;  &lt;p&gt;Some examples on how to use it would include:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Creating websites on your dev machine.&amp;#160; site1.localtest.me, site2.localtest.me, site3.localtest.me.&lt;/li&gt;    &lt;li&gt;Great for URL Rewrite (IIS) or mod_rewrite (Apache) testing: redirect.localtest.me, failuretest.localtest.me, subdomain.localtest.me, city1.localtest.me.&lt;/li&gt;    &lt;li&gt;Any testing on your local system where a friendly URL would be useful.&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;I hope you enjoy!&lt;/p&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=8477060" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/owscott/archive/tags/IIS/default.aspx">IIS</category><category domain="http://weblogs.asp.net/owscott/archive/tags/IIS7/default.aspx">IIS7</category><category domain="http://weblogs.asp.net/owscott/archive/tags/IIS8/default.aspx">IIS8</category><category domain="http://weblogs.asp.net/owscott/archive/tags/Troubleshooting/default.aspx">Troubleshooting</category><category domain="http://weblogs.asp.net/owscott/archive/tags/Windows+7/default.aspx">Windows 7</category><category domain="http://weblogs.asp.net/owscott/archive/tags/Windows+Server/default.aspx">Windows Server</category></item><item><title>Introducing Testing Domain - localtest.me</title><link>http://blogs.iis.net/owscott/archive/2012/05/14/introducing-testing-domain-localtest-me.aspx</link><pubDate>Mon, 14 May 2012 15:59:54 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:8477252</guid><dc:creator>The Official Microsoft IIS Site</dc:creator><slash:comments>0</slash:comments><description>Save this URL, memorize it, write it on a sticky note, tweet it, tell your colleagues about it!&amp;#160; localtest.me ( http://localtest.me ) and *.localtest.me ( http://something.localtest.me ) If you do any testing on your local system you’ve probably Read More......( read more ) Read More......(&lt;a href="http://blogs.iis.net/owscott/archive/2012/05/14/introducing-testing-domain-localtest-me.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=8477252" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/iis/archive/tags/IIS/default.aspx">IIS</category><category domain="http://weblogs.asp.net/iis/archive/tags/IIS7/default.aspx">IIS7</category><category domain="http://weblogs.asp.net/iis/archive/tags/IIS8/default.aspx">IIS8</category><category domain="http://weblogs.asp.net/iis/archive/tags/troubleshooting/default.aspx">troubleshooting</category><category domain="http://weblogs.asp.net/iis/archive/tags/Windows+7/default.aspx">Windows 7</category><category domain="http://weblogs.asp.net/iis/archive/tags/Windows+Server/default.aspx">Windows Server</category></item><item><title>eLearning event on HTML5 for Mobile with jQuery Mobile - May 17</title><link>http://weblogs.asp.net/wallym/archive/2012/05/14/elearning-event-on-html5-for-mobile-with-jquery-mobile-may-17.aspx</link><pubDate>Mon, 14 May 2012 10:00:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:8475089</guid><dc:creator>Wallym</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;I'll be doing an &lt;a href="http://elearning.left-brain.com/event/mobile-web-development" mce_href="http://elearning.left-brain.com/event/mobile-web-development" target="_blank"&gt;eLearning event on HTML5 for Mobile with jQuery Mobile&lt;/a&gt;.  There will also be a few items sprinkled in on ASP.NET Razor. &lt;br&gt; &lt;br&gt;
Mobile development is a hot item. Customers are buying iPhones, iPads, 
Android devices, and many other mobile computing devices at an ever 
increasing record pace. Devices based on iOS and Android are nearly 80 
percent of the marketplace. RIM continues to be dominant in the business
 area across the world. Nokia's growth with Windows Phone will grow on a
 worldwide basis. At the same time, clearly web development is a 
tremendous driver of applications, both on the public Internet and on 
private networks. How can developers target these various mobile 
platforms with web technologies? Developers can write web applications 
that take advantage of each mobile platform, but that is a lot of work. 
Into this space, the jQuery Mobile framework was developed. This 
eLearning series will provide an overview of mobile web development with
 jQuery Mobile, a detailed look at what the jQuery Mobile framework 
provides for us, how we can customize jQuery Mobile, and how we can use 
jQuery Mobile inside of ASP.NET.&lt;/p&gt;Link: &lt;a href="http://elearning.left-brain.com/event/mobile-web-development" mce_href="http://elearning.left-brain.com/event/mobile-web-development" target="_blank"&gt;http://elearning.left-brain.com/event/mobile-web-development&lt;/a&gt; &lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=8475089" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/wallym/archive/tags/Community+News/default.aspx">Community News</category><category domain="http://weblogs.asp.net/wallym/archive/tags/html/default.aspx">html</category><category domain="http://weblogs.asp.net/wallym/archive/tags/html5/default.aspx">html5</category><category domain="http://weblogs.asp.net/wallym/archive/tags/jquery/default.aspx">jquery</category><category domain="http://weblogs.asp.net/wallym/archive/tags/mobile/default.aspx">mobile</category><category domain="http://weblogs.asp.net/wallym/archive/tags/mobile+development/default.aspx">mobile development</category><category domain="http://weblogs.asp.net/wallym/archive/tags/jquery+mobile/default.aspx">jquery mobile</category></item><item><title>Windows Azure SDK for Node.js 0.5.4 Released</title><link>http://weblogs.asp.net/shijuvarghese/archive/2012/05/14/windows-azure-sdk-for-node-js-0-5-4-released.aspx</link><pubDate>Mon, 14 May 2012 06:14:58 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:8475699</guid><dc:creator>shiju</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;&lt;font size="2"&gt;The Microsoft Windows Azure team has released the Windows Azure SDK for Node.js 0.5.4 which&amp;#160; will be using the Node.js 0.6.17 and iisnode 0.1.19. The Node.js 0.6.17 contains a security fix against the &lt;/font&gt;&lt;a href="http://blog.nodejs.org/2012/05/07/http-server-security-vulnerability-please-upgrade-to-0-6-17/" target="_blank"&gt;&lt;font size="2"&gt;HTTP Server Security Vulnerability&lt;/font&gt;&lt;/a&gt;&lt;font size="2"&gt; detected by recently. It would be recommended to upgrade to the new version of Azure SDK for Node.js if you have already deployed any Node.js app to Windows Azure which will provide better security. The iisnode 0.1.19 provides &lt;/font&gt;&lt;a href="http://tomasz.janczuk.org/2012/05/yaml-configuration-support-in-iisnode.html" target="_blank"&gt;&lt;font size="2"&gt;iisnode.yml&lt;/font&gt;&lt;/a&gt;&lt;font size="2"&gt; file instead of XML based configurations which can be use for setting up all iisnode settings. You can download the Windows Azure SDK for Node.js 0.5.4 from &lt;/font&gt;&lt;a href="http://www.microsoft.com/web/gallery/install.aspx?appid=azurenodepowershell" target="_blank"&gt;&lt;font size="2"&gt;here&lt;/font&gt;&lt;/a&gt;&lt;font size="2"&gt;.&lt;/font&gt;&lt;/p&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=8475699" width="1" height="1"&gt;</description><category domain="http://weblogs.asp.net/shijuvarghese/archive/tags/.Net/default.aspx">.Net</category><category domain="http://weblogs.asp.net/shijuvarghese/archive/tags/Azure/default.aspx">Azure</category><category domain="http://weblogs.asp.net/shijuvarghese/archive/tags/Node.js/default.aspx">Node.js</category><category domain="http://weblogs.asp.net/shijuvarghese/archive/tags/Windows+Azure/default.aspx">Windows Azure</category></item></channel></rss>
