June 2008 - Posts

ASP.NET Podcast Show #118 - Peer-To-Peer with Windows Communication Foundation (WCF)
Friday, June 20, 2008 9:20 AM

So I *finally* managed to get a videocast/podcast done. Wally has been harassing me for ages, and I eventually had the time to get one done. This one is on the Peer to Peer support in Windows Communication Foundation (WCF) and how easy it is to do. Its remarkably simple yet extremely powerful.

I hope you enjoy it.

Subscribe to EVERYTHING <-- What you REALLY WANT TO DO!

Original Url: http://aspnetpodcast.com/CS11/blogs/asp.net_podcast/archive/2008/06/19/asp-net-podcast-show-118-paul-on-peer-to-peer-with-windows-communication-foundation.aspx

Subscribe to WMV Video only.

Subscribe to M4V Video only.

Subscribe to MP3 Audio only.

Download WMV.

Download M4V.

Download MP3.

Show Notes:

Download Source Code

by Glav | 3 comment(s)
Filed under: , , , ,
WCF services getting errors when hosting in IIS
Wednesday, June 4, 2008 11:42 AM

This post is more for my own records than anything and I have been meaning to write this down for some time.


Had a WCF Web Service that was being hosted in IIS. Worked in dev and test fine. Moved to prod and bang, I get the following error:

This collection already contains an address with scheme http. There can be at most one address per scheme in this collection.
Parameter name: item

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ArgumentException: This collection already contains an address with scheme http.  There can be at most one address per scheme in this collection.
Parameter name: item



The production server had multiple host headers defined within IIS, meaning that the HTTP base address being passed through actually consisted of 2 base addresses with the HTTP scheme, which is not allowed when hosting WCF services in WCF.

The Solution:

Easy: Remove the multiple host headers. In my scenario, this was a viable solution as the multiple host headers were not actually necessary and represented some 'left over' configuration.

Harder, but more flexible and solid: Create a custom service factory to strip out the unwanted base address as outlined in a good post by Rob Zelt.

by Glav | 2 comment(s)
Filed under: , , ,
VSTS 2008, Web Tests and using Fiddler
Tuesday, June 3, 2008 5:04 PM

I have been doing some performance and load testing of a web application I have been working on lately. Most of my previous experience was with the 2005 flavour of VSTS and I was keen to play with the 2008 version to see what improvements have been made. This web application is quite heavy in terms of Javascript and AJAX feature usage.

I am happy to report that things are much better in this version, but still not as easy as I had hoped. Form value extraction and recognition of AJAX requests seem to work well.

However, I still had some problems running the tests. For the most part they would run ok, but would cause errors on the server such as:

'Index was outside the bounds of the array.' at System.Web.Handlers.ScriptResourceHandler.ProcessRequest

which was always when accessing some script resource via the ScriptResource.axd handler.

I could see no reference to any of my code in there. Everything seemed to work as far as the client aspect was concerned (examining the results of the web tests) but this did not sit too well with me.

So I decided to try and record some tests via Fiddler2 HTTP proxy tool to see if that helped. There was definitely a little more work in getting this to record and playback web tests properly, but I was able to get some cleaner looking tests, and no errors generated on the server using this method. I did verify that all the functionality was being exercised on the server just in case I was missing anything and getting false positives.

The procedure I used to record web tests and get them working was.

  • Load Fiddler2
  • Load Internet Explorer and browse to the site, running through my specific performance test scenario.
  • In Fiddler, press F12 to ensure no more sessions/traffic is captured.
  • Select all the sessions by using CTRL-A (ensuing there was no other traffic that got recorded at the time. If there was, just highlight that session and delete it)
  • Go to the File >> Save >> Sessions >> As Visual Studio Web Test menu optionimage
  • In Visual Studio 2008, within your test project, add in the existing web test.
  • VS2008 will add some 'Form Field' extraction rules to each request.


  • If you are using UpdatePanel's a lot and need to extract the ViewState from UpdatePanel delta responses, you will need to change the extraction rule.
  • For this I created a Text Extraction rule.


  • This rule simply looks for __VIEWSTATE| (yes, that's a pipe char on the end) as the start text and a pipe | as the end delimiter text and extracts everything in between.


  • I had to add this extraction rule to each request, and replace the references to the old Form field extraction value


  • with references to our new AJAX text extraction rule.


Like I said, it was a little bit of work to go through each page request and fix it in this manner, but the tests execute cleanly every time with no errors on the server as previously mentioned and it is actually a neater looking web test.

Profiling your AJAX Applications using AjaxView
Tuesday, June 3, 2008 4:35 PM

Don't know if this has already been discussed at length before, but I found an interesting little tool from Microsoft Research for profiling the Javascript functionality in your AJAX applications.

Its called AjaxView and can remotely monitor any AJAX web app that is currently on the web, locally or whatever.

You basically, install a small proxy application, then change your Internet Explorer LAN connection to go through a proxy of localhost:8888.

Go and browse your web application or your own AJAX app, and execute your normal series of functionality.

Once your done, you then browse to a page generated by the tool itself


This gets you something like this:



You can then click on whatever item you want, typically the site that represents the worst performance. You'll then get something like this:


Here I have clicked on the 'Mean Time (ms)' view to get column sorted by the slowest functions. If I want to drill down a bit more, I can click on the 'Details' link which gives me:


This shows me a breakdown of which functions took how long.

Its actually a pretty quick way to get a good idea of what is consuming a lot of client side cycles from a Javascript perspective. The tool is a little raw and is still somewhat rough, but its easy enough to use and get going and worth a quick look.

More Posts

This Blog