diff --git a/samples/MvcSample.Web/Monitoring/MonitoringMiddlware.cs b/samples/MvcSample.Web/Monitoring/MonitoringMiddlware.cs
new file mode 100644
index 0000000000..da3bbfeaa1
--- /dev/null
+++ b/samples/MvcSample.Web/Monitoring/MonitoringMiddlware.cs
@@ -0,0 +1,108 @@
+#if NET45
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Autofac.Core;
+using Microsoft.AspNet.Builder;
+using Microsoft.AspNet.Http;
+
+namespace MvcSample.Web
+{
+ ///
+ /// Summary description for MonitoringMiddlware
+ ///
+ public class MonitoringMiddlware
+ {
+ private RequestDelegate _next;
+ private IServiceProvider _services;
+
+ public MonitoringMiddlware(RequestDelegate next, IServiceProvider services)
+ {
+ _next = next;
+ _services = services;
+ }
+
+ public async Task Invoke(HttpContext httpContext)
+ {
+ var url = httpContext.Request.Path.Value;
+
+ if (url.Equals("/Monitoring/Clear", StringComparison.OrdinalIgnoreCase))
+ {
+ MonitoringModule.Clear();
+ httpContext.Response.ContentType = "text/plain";
+ var buffer = Encoding.ASCII.GetBytes("Cleared");
+ httpContext.Response.Body.Write(buffer, 0, buffer.Length);
+ }
+ else if (url.Equals("/Monitoring/ActivatedTypes", StringComparison.OrdinalIgnoreCase))
+ {
+ var data = ActivatedTypes();
+ httpContext.Response.ContentType = "text/plain charset=utf-8";
+ var buffer = Encoding.UTF8.GetBytes(data);
+
+ httpContext.Response.Body.Write(buffer, 0, buffer.Length);
+ }
+ else
+ {
+ await _next(httpContext);
+ }
+ }
+
+ public string ActivatedTypes()
+ {
+ var values = MonitoringModule.InstanceCount.ToArray();
+
+ var builder = new StringBuilder();
+
+ Array.Sort(values, new InstancesComparer());
+
+ foreach (var item in values)
+ {
+ builder.AppendLine(GetTypeName(item.Key.Item1) + " " + item.Value);
+ }
+
+ return builder.ToString();
+ }
+
+ private string GetTypeName(Type type)
+ {
+ var name = type.Name;
+ var isArray = false;
+
+ if (typeof(Array).IsAssignableFrom(type))
+ {
+ isArray = true;
+ name = ChopLast2(name);
+ }
+
+ var genericArgs = type.GetGenericArguments().Select(t => t.Name).ToArray();
+
+ if (genericArgs.Length > 0)
+ {
+ name = ChopLast2(name) + "<" + string.Join(",", genericArgs) + ">";
+ }
+
+ if (isArray)
+ {
+ name += "[]";
+ }
+
+ return name;
+ }
+
+ private static string ChopLast2(string name)
+ {
+ return name.Remove(name.Length - 2);
+ }
+
+ private class InstancesComparer : IComparer, int>>
+ {
+ public int Compare(KeyValuePair, int> x, KeyValuePair, int> y)
+ {
+ return y.Value.CompareTo(x.Value);
+ }
+ }
+ }
+}
+#endif
\ No newline at end of file
diff --git a/samples/MvcSample.Web/Monitoring/MonitoringModule.cs b/samples/MvcSample.Web/Monitoring/MonitoringModule.cs
new file mode 100644
index 0000000000..dffaa1b503
--- /dev/null
+++ b/samples/MvcSample.Web/Monitoring/MonitoringModule.cs
@@ -0,0 +1,77 @@
+#if NET45
+using System;
+using System.Collections.Concurrent;
+using Autofac;
+using Autofac.Core;
+
+namespace MvcSample.Web
+{
+ ///
+ /// Summary description for MonitoringModule
+ ///
+ public class MonitoringModule : Module
+ {
+ private static ConcurrentDictionary, int> _registrations
+ = new ConcurrentDictionary, int>();
+
+ private static ConcurrentDictionary, object> _instances
+ = new ConcurrentDictionary, object>();
+
+ public static readonly ConcurrentDictionary, int> InstanceCount
+ = new ConcurrentDictionary, int>();
+
+ protected override void AttachToComponentRegistration(IComponentRegistry componentRegistry,
+ IComponentRegistration registration)
+ {
+ registration.Activating += Registration_Activating;
+ registration.Activated += Registration_Activated;
+ }
+
+ public Tuple GetKey(IComponentRegistration context)
+ {
+ var activator = context.Activator;
+ var lifeTime = context.Lifetime;
+ var limitType = context.Activator.LimitType;
+
+ var key = new Tuple(limitType, lifeTime);
+
+ return key;
+ }
+ private void Registration_Activated(object sender, ActivatedEventArgs