Thursday, 14 January 2010

AOP (Aspect Orientated Programming) with Sprint.Net

Sprint.Net provides very good documentation regarding Aspect Orientated Programming (Aop). It's really a very nice way of separating logging, transaction and performance monitoring functionality from your code.

I would suggest anyone who's interested to read this article

Saturday, 2 January 2010

Removing duplicate files from iTunes library

Found this tool Dupe Eliminator 9.2 which you can get for free if you use trialpay to purchase stuff from argos and many other providers.

Tuesday, 22 December 2009

Webcontrol being serialized by ASP.NET but not added to Session state

I had an issue where I had a property on a webcontrol that was being added to the session state (StateService). The property object was marked as serializable. But for some reason ASP.NET was trying to add the webcontrol to the session by serializing it and a serialization exception was being thrown.

After quite a bit of investigation I found this very useful article.

In conclusion, on one of my child properties there was an event which was being assigned to an event handler within the page load of the webcontrol. Applying the workaround mentioned in the article solved my problem.

Tuesday, 1 December 2009

Invalid ViewState... ScriptResource.axd and Performance issues of late

I've been looking recently into performance issues we were experiencing on one of our websites. This meant delving back into IIS application pools, running red-gate memory profiler and generally having a blast ;)

The code base is part legacy code, which has not been extended correctly. The memory profiling highlighted one key factor which I think is vital, and is stressed in multiple performance articles scattered across the web.

Be careful with session state, if it's too big your system is going to suffer

The code base has allot of complex objects which in turn have complex children, these are placed into session state and hang around eating up the w3wp.exe memory. All the session objects are run in-proc which is necessary because the objects have components that cannot be serialized, so extracting the session state to an out of proce provider was not an option.

We ended up increasing the memory on the server, to buy us sometime to reduce the complexity of the session objects and find alternative methods of clearing the session state periodically.

Another issue on the same server was we were seeing allot of Invalid ViewState error messages in the application event log. I read this article which pointed my focus in the right direction.

Basically the DOCTYPE's on my website pages were set to use strict XHTML, and the ScriptResource.axd which contains all client side AJAX javascript was being incorrectly parsed by the browser. Therefore when sent back to the server the viewstate was invalid, and so we got the error.

The solution was to change the browser to use the HTML DOCTYPE. This however messed up the display of the website, which I'm currently looking into now.

Thursday, 19 November 2009

_PublishedWebsites missing when using MSBuild

Had some issues with msbuild this morning. The build was successful but when I looked into the drop location, there was no folder _PublishedWebsites only a list of all the bin dll's.

This was the most useful link I found which explains how to change your projects csproj file in order to force msbuild to create and dump website files and folders into the drop locations _PublishedWebsites directory. (Basically so that msbuild knows the project is a web application)

All you need to do is in the csproj file is to include this line:

<Import 
Project="
    $(MSBuildExtensionsPath)\
    Microsoft\VisualStudio\v9.0\
    WebApplications\Microsoft.WebApplication.targets" 
Condition="" />

Wednesday, 18 November 2009

Vista wireless internet connection not working

I noticed periodically that my wireless connection to the internet was being dropped on my Windows Vista laptop, which only would work again after a restart.

After googling around a bit, the common problem seemed to be that Vista try’s to manage your power and one of the features is it will turn off the wireless adapter to save precious power.

So here are some simple steps to disable this feature, and allow yourself to freely browse the internet wirelessly from your vista PC.
  • Select start -> Control Panel -> Network and Sharing Centre
  • Then under tasks on the left click Manage Network Connections
  • Right click your wirless network connection, and select properties. (Click continue to ensure you allow Vista permission to continue)
  • Click configure, then click the Power Management tab
  • Untick Allow the computer to turn off this device to save power

Disable the Microsoft Application Error Reporting (DW20.exe)

Hi

We have a web application that writes to a network path, and to cut a long story short that path changed because of a hardware failure. This however brought up some strange behaviour...

On the machine that hosts the web application that is trying to write to the network share, we noticed it started to run very slowly. After looking at the task manager we found a few instances of DW20.exe hogging the memory.

Google told me that DW20.exe was actually Microsofts error reporting process. I then found this very useful link which tells you how to disable it.

After killing the DW20.exe processes however the machine had then run out of disk space??? I ran windirstat on the machine to see where all the space had gone. Turns out it had been used by some .dmp files in windows\temp directory. These files were generated also by DW20.exe.

So in summary I'm not so sure why Microsoft's error reporting tool would use so much memory and create dump files that big, however my solution was to disable the error reporting, and kill all the DW20.exe processes and delete the .dmp files.