Visual Studio 2008 and TFS 2010

We recently upgraded our TFS to 2010, but we need to still keep using Visual Studio 2008 for reports (a bit of a gripe that we still have to do this!).  Anyway to get this working properly you just need to download this patch:

Dec 22 andrew.thomas |

Setting caching response with VaryByParams doesn't cache on client

I have had a major issue recently where the caching of programatic code was happening fine on the server, but it was causing a round-trip response from the client, even though I had set the expirary for an hour and had set HttpCacheability.Public.

After much a huge amount of fustration and trial and error I found that the header "Vary = *", was being passed, even though I was only passing by arguments.  To fix this I found that there is a hack response.Cache.SetOmitVaryStar(true), which omits the vary header and allows client caching.

Major headache solved!

See this article for more information

IIS Adding development certificate

To setup a test certificate you use the following command (ensure you open the command prompt through Visual Studio Command prompt):

makecert -r -pe -n "CN=localhost" -b 01/01/2000 -e 01/01/2050 -eku -ss my -sr localMachine -sky exchange -sp "Microsoft RSA SChannel Cryptographic Provider" -sy 12

You may also get the following error:

The X.509 certificate CN=localhost chain building failed. The certificate that was used has a trust chain that cannot be verified. Replace the certificate or change the certificateValidationMode. The revocation function was unable to check revocation for the certificate

if so setup the CertificationValidationMode to None (just for debug!):

client.ClientCredentials.ServiceCertificate.Authentication.CertificateValidationMode = X509CertificateValidationMode.None;

Visual Studio 2008 Large Database Performance Optimisation

We are at that point now with our database where it is around 40GB, and growing 200mb per day.  Having just added more RAM to help the servers perform better I had to start really looking deep into how to make it more efficient.  The database is as normalised as possible (with the exception of a few extra smallint columns to make some reports hugely quicker).  So I had to dig deeper to see how to make more savings.

Interesting where I found most of the savings was chaning data types to something smaller where possible, even if there was a loss of precision (for instance the smalldatetime only goes to the nearest minute, but that is fine in most situations).  This really had an impact on table size, and index sizes dropped dramatically.  Overall the database shrunk by 30%, and indexes on large tables by around 20% reduced too.

Datatype changes I made were:

  • int -> smallint  (for companies we would never have more than 32000 so fit well, and it was heavily indexed column)
  • datetime -> smalldatetime (save massive space in our tracking tables, and loss of precision is acceptable)
  • nvarchar -> varchar (could only do this for URLs, and others that I new wouldn't contain unicode, but massive savings)
  • decimal (18,2) -> decimal(9,2) (didn't need that extra precision ever)

More tips to follow soon.

Visual Studio 2008 ASPX designer freezes after installation of Office 2010

This really stumped me for a while and was incredibly annoying.  I didn't click that it was Microsoft Office that caused the issue until some serious digging around the internet.

Repariing the Microsoft Visual Studio Web Authoring Component fixed this issue.

Windows (64-bit)

C:\Program Files (x86)\Common Files\microsoft shared\OFFICE12\Office Setup Controller\Setup.exe

Windows (32-bit)

C:\Program Files\Common Files\microsoft shared\OFFICE12\Office Setup Controller\Setup.exe

Thanks to this post for helping:

Downloading files in Internet Explorer 8 causing gets error "Unable to download xxx..."

I was receiving an error from Internet Explorer along the lines of "unable to download xxx ... Unable to open this internet site ...".

The weird thing was that the second time onwards it would download fine.  After much searching I found that I had the following line:


This caching was the cause of the issues.  Removing this solved the problem.

I hope this helps someone save a lot of time :)

IFrame links to a site on a different domain that requires ASP.Net Authentication

I have struggled for ages with an issue that was only happening in Internet Explorer where I had a site  This had an iFrame to, but Ii also had a login redirect at to do FormsAuthentication.

This worked in all browsers except Internet Explorer which would never log in correctly.

After much struggling what I needed to do was add the p3p header P3P: CP="CAO PSA OUR" into IIS.  This reduced the privacy issue that was stopping IE.

WCF + IIS + SSL + HTTPS = Big headache

I built a secure webservice a while ago, but it finally got used by a third party today.  That exposed an issue, where it was only working in http:// mode (i.e. not in secure mode).  And when I tried with https: it kept giving the error:

[EndpointNotFoundException: There was no endpoint listening at https://xxxxx....]

[WebException: The remote server returned an error: (404) Not Found.]
   System.Net.HttpWebRequest.GetResponse() +5314029
   System.ServiceModel.Channels.HttpChannelRequest.WaitForReply(TimeSpan timeout) +54

I looked every where on the internet but couldn't find a solution.  Eventually after trial and error I found what was wrong.

On the server in my web.config I had:

        <binding name="IstMembershipBinding">
          <security mode="Message">
            <message clientCredentialType="UserName" />        

This meant that on the client I could only do Message security (so no https://)/. Changing this toTransportWithMessageCredential meant I had to use SSL (which was fine) and everything worked. Four hours wasted for one line of code...

Google AdWords Certified Individual + Partner

Finally got around to sitting the two tests that are required to get certified.  The fundamentals exam wasn't too bad, scored 93% - although you can't use any online material as it locks your computer.  I was surprised about this, but luckily prepared in my study.

The advanced exam was a lot tougher, managed 82% which I think is only just a pass.  You really need to study the final details and have extensive use of the online interface and the AdWords Editor, as quite a few questions in there.

Admittingly I was unimpressed by the individual and company profiles that google supplies, it almost looks like an after thought.  But the fact our company gets 20 x USD$100 AdWords advertising vouchers four times a year certainly means it pays for itself.  It will be interesting to see if we get any more business because of it.

My AdWords profile is here and company site is Ultimate Feed.

WCF Service - HTTP Error 404.3 - Not Found

When I started using WCF Service on IIS 7 on my machine I got the following error:

Server Error in Application “Default Web Site/...”
HTTP Error 404.3 - Not Found

The page you are requesting cannot be served because of the extension of the configuration. If the page is a script, add a handler. If the file should be downloaded, add a MIME map.

After much googling online this is what I did to have it work:

Start the command window as an Administrator.
If you use 32 bit then open the folder:
C:\windows\Microsoft.Net\Framework\v3.0\Windows Communication Foundation\
or 64 bit then open:
C:\windows\Microsoft.Net\Framework64\v3.0\Windows Communication Foundation\

Run the following:
ServiceModelReg –i

About Me

I am 27year old living in London.  Director of Development for an online technology/marketing company - Intuitive Search Technologies.