Skip to content

MVC Mini Profiler

14-Nov-11

I’ve started to use the very helpful Mini-Profiler in my apps and love the base functionality provided and optional approach to profiling specific portions of your application. It’s worth mentioning that Mini-Profiler is open source and used in production by the folks at StackOverflow, so feel confident that it is a solid assembly with plenty of options to meet your needs.

For those that haven’t checked it out, bring MiniProfiler into your application via NuGet with a

Install-Package MiniProfiler

If you are working in a web project (MVC, WebForms), you simply add the following line of code in your head block AFTER your jQuery reference (this line is formatted as Razor for MVC 3) -

@MvcMiniProfiler.MiniProfiler.RenderIncludes()

One thing worth mentioning is that on IE9, I had some issues with the UI of the profiler displaying appropriately. I looked around and found a post mentioning adding the following to your CSS file and sure enough, it fixed my IE9 issue. So, give it a shot if you have any problems displaying the profile on Internet Explorer.

div.profiler-popup
{
    overflow: visible !important;
}

Mini-Profiler UI on a simple ASP.NET MVC 3 page

I’ve had success using this for profiling ASP.NET MVC3 applications as well as Entity Framework 4.2 “Code First” queries within the apps, which is great. I still really like the Entity Framework Profiler tool from Hibernating Rhinos and rely on it heavily, but Mini-Profiler does a good job of showing ORM query issues.

I plan to try this out with some old WCF projects in the near future as well. In the meantime, pop it into one of your development applications and make sure your code is performing how you expect.

Slides from my “Intro to SignalR” presentation at Desert Code Camp

08-Nov-11

I uploaded the slides from my “Intro to SignalR” presentation at Desert Code Camp 2011.2 which was held this past weekend (11/05/2011) at Chandler-Gilbert Community College.

I did add some additional bullet points and text content to the slide deck since I’m not a big fan of standing in front of a bunch of that during a presentation and would rather talk with the attendees and show some code. Either way, check the slides out if you’d like.

http://www.slideshare.net/adammokan/introduction-to-signalr-10082193

Next up is some tweaks to my samples, which were not cooperating with me so much during my session. I will expose that repo on Github soon and post an update.

Enjoy.

Presenting on SignalR at Desert Code Camp 2011.2

02-Nov-11

I will be presenting on SignalR at Desert Code Camp this weekend (November 5th, 2011), for anyone in the metro-Phoenix area.

My SignalR session begins at 11:30am (hour long) and will be held in room IRN-125.

For more info on Desert Code Camp, visit http://nov2011.desertcodecamp.com

NuGet.Server sample project

12-Oct-11

A couple days ago I mentioned how simple getting an internal Nuget repository via NuGet.Server was. Apparently, it didn’t go as smooth for others as it did for me based on some replies and DMs.

So, I setup a new sample project and pushed it to github for anyone to try. I have succesfully tested this sample in IIS Express as well as IIS 7. Both had no issues after some minor adjustments. For IIS Express I do note some modifications in the README in the github repo that you should take note of. But simply cloning and running should get you going. Be sure, if you are in Visual Studio, that you tell the project to use IIS Express though.

Here is the link to the sample project on github - https://github.com/amokan/Nuget.Server-Sample-Project

The basic steps to create the project like I did were:

  1. Create a new “ASP.NET Empty Web Application” in Visual Studio.
  2. Either use the GUI or NuGet Console to install the Nuget.Server package.
  3. Adjust the web.config, as needed.
  4. Profit (or happiness… i’m not sure what’s motivating you here)
Enjoy and hopefully this works for someone out there!

node.js running in a Windows Azure Worker Role

20-Jul-11

Since the release of node.js version 0.5.1 (download link here) on July 14th, the Windows platform finally has a native node.exe binary that doesn’t require Cygwin or any other work-around to play with node.js on Windows. I did a small test yesterday by downloading the exe and putting it’s folder in my local Win7 PATH environment variable and had simple node.js samples working right in Notepad++, which was entertaining. 0.5.1 is an “unstable” release, so don’t expect to launch your production site on it, but it removes a barrier of entry for those stuck on Windows.

Based on the test yesterday, I dug up an old blog post by Steve Marx (@smarx on twitter) that demonstrated running the Mongoose web server in a Windows Azure Worker Role on port 80. Using his example as a basis, I did the same with node.exe and it worked on the first attempt.

Check out the live site here*http://nodetest.cloudapp.net/

Node worker role in my azure dashboard

node.js worker role in my azure dashboard

Azure Worker Role Settings

worker role settings in azure

I’ve not even messed with nvm or npm on Windows (and have no clue if they even work yet) or frameworks such as Express, which I enjoy for larger node projects. Here is a gist for the basic sample in the project. Even if you have never looked at node (but understand HTTP), it should be fairly clear.

I have posted the full source for the entire project on github and you should be able to simply download/clone and deploy to Azure with no issues. As mentioned in the readme file, the node application code is in the src/WorkerRole/node/ directory, along with node.exe itself.

I used a single ‘Extra Small’ instance and OSFamily ’2′ in case I wanted to do anything more advanced with PowerShell later on. I’m sure OSFamily ’1′ would be perfectly fine.

Github source - https://github.com/amokan/node-on-azure

If anyone else is doing any work with node.exe in an Azure role, be sure to post your findings and let’s see how far we can push this thing. Node is an amazing piece of technology and a great solution for high-performance APIs and shows the true power of JavaScript. The next step is integrating node with Azure Table Storage and other features in the Azure ecosystem. Maybe that’s already been done?

* I will leave the live sample running on Azure for a while. If the extra small instance gets slammed for some odd reason, I will drop it and update the post.