Exposing locally running Web API to external world using ngrok

Web API Local URL


ngrok to make this URL work for external users

ngrok http [port] -host-header="localhost:[port]"


The Onion Architecture : part 1 : Jeffrey Palermo (.com)

The Onion Architecture : part 129 July 2008This is part 1.  part 2. part 3. part 4.  My feed (rss).I’ve spoken several times about a specific type of architecture I call “Onion Architecture”.  I’ve found that it leads to more maintainable applications since it emphasizes separation of concerns throughout the system.  I must set the context for the use of this architecture before proceeding.  This architecture is not appropriate for small websites.  It is appropriate for long-lived business applications as well as applications with complex behavior.  It emphasizes the use of interfaces for behavior contracts, and it forces the externalization of

Source: The Onion Architecture : part 1 : Jeffrey Palermo (.com)

Service Locator example in c#

publicinterfaceICustomer  { string GetCustomerName(); 
  • Implement ICustomer interface.
 classCustomer : ICustomer
    {            publicstring GetCustomerName()          {             return"Customer 1";          	 }      }
  • Create a ServiceLocator as shown below and add the mapping of ICustomer and its real implementation class.
    {         T GetService<T>();     }      	publicclassServiceLocatorSimple : IServiceLocator
    {    	// map that contains pairs of interfaces and
// references to concrete implementations
privateIDictionary<object, object> services;         	 public ServiceLocatorSimple()          {              	services = newDictionary<object, object>();              // fill the map
this.services.Add(typeof(ICustomer), newCustomer());         }         	 public T GetService<T>()         	 {   try
            {                 	    return (T)services[typeof(T)];               }              catch (KeyNotFoundException)  { thrownewApplicationException("The requested service is not registered"); }          }     }
  • Create a client application to consume it .
 staticvoid Main(string[] args)          {           
  IServiceLocator serviceLocator = newServiceLocatorSimple();     
ICustomer customersaervice = serviceLocator.GetService<ICustomer>();  
 Console.WriteLine(customersaervice.GetCustomerName());          }

Now Client application does not know about the concrete implementation. we can easily change the implementation without effecting 
client application.

Automatic file checkout is missing in VS2010 and TFS

I have recently came to a strange behavior. I am using VS 2010 (ultimate edition) and TFS 2010. In past the  with VSS when even I edit any file it gets automatically checked out and see the small icon for it in with filename.


Now I do not get it any more Sad smile

Reason: You solution is not binded with the source control.


1. Go to File—> Source Control—> Change Source Control




2. Select all the projects in your solution file and BIND them . 



That’s it

Running websites in asp.net 2.0 and 4.0 on same IIS

This sounds like a very difficult task but its really now.

Lets take it a scenario to make it happen .

I have a Widows 2008 server with IIS 6.1 installed on it . I have some applications running on it already which are built on .net2.0 framework.

I want to host new application built in .net 3.5 or 4.0 framework .


  1. Download the new framework from below link


2. install it .

3. Restart computer

4.now register the new framework on IIS server



5. Now you will get new framework application pool in your IIS


6. Assign this application to your application.


That’s it!!