Queries time out from asp.net web app but run fine from management studio

25. February 2013 15:57 by Chris in dev  //  Tags:   //   Comments (0)

I had a support issue from a client today which turned out to be an interesting one I hadn't come across before so I thought I would share. Thankfully, others had so once I had identified exactly what the issue was google and stack overflow were able to quickly assist.

The scenario that initially bemused me was that fact that running a complex search sproc from SQL Server Management Studio was returning in a couple of seconds but exactly the same parameters fired into the sproc from ASP.NET caused the web app to timeout. Earlier I had even tried extending the default commandTimeout from 30secs to 4mins without success so SQL Server had really got it's knickers in a twist. Further the issue just appeared one day and I also couldn't replicate in the staging environment, which had similar data volumes.

It turns out others had hit the issue before, e.g.

http://stackoverflow.com/questions/9974/query-times-out-from-web-app-but-runs-fine-from-management-studio

It turns out the ADO.NET and Management studio connection/ user contexts differed and in my case, as per the link above, the explicit setting of the arithabort property brought the performance back to expected levels. Further, adding this in one sproc also fixed the issue with other reporting sprocs of the solution. Go figure.

 

Consumption 2013

7. February 2013 13:38 by Chris in ForTheRecod  //  Tags:   //   Comments (0)

Books

Welsh is the priority:

 

Bywyd Blodwen Jones gan Bethan Gwanas (1999)

Blodwen Jones a'r Aderyn Prin gan Bethan Gwanas (2001)

Tri Chynnig i Blodwen Jones gan Bethan Gwanas (2003)

The Hunger Games Trilogy - no.3 was comparably weak.

 

Films

Comments with a score rather than reviews:

 Watched in 2013

  • Django Unchained 7.5/10; bit silly in places ... but this is Tarantino
  • The Dark Knight Rises Lengthy but held the attention. Anne Hathaway a plus.  8/10
  • Silver Lining Playbook Grabbed plenty of plaudits but a few flaws 8/10
  • Hunger Games Better than expected 7/10
  • Dredd - violent but well implemented. Set up for a sequel. 7/10
  • Skyfall All v.silly 6.5/10
  • Looper - reasonably complex SciFi without too many holes 8/10 

 

Music

  • Opposites - Biffy Clyro

TV

  • Gwaith Cartref
  • Game of Thrones - racist ... really? Just enjoy.
  • Mad Men
  • Frankie

 

Beer

  •  PIPES

 

Sport

  • Go Cymru/ Lions!
  • Congrats Andy Murray

 

Resource Files (.rex) Usage Notes from the Field

4. February 2013 14:54 by Chris in dev  //  Tags:   //   Comments (0)

I set up a website with resource files in ASP.NET, MVC4 as it happens but makes little difference. This because the site is bilingual - Welsh and English. 

Post launch the client wanted a content change which involved changing a resource file but, perhaps because of my implementation 'choices' the site did not dynamically pick up the .resx change. I thought, in my ignorance, that maybe I needed to force a recompile so changed the web.config. This didn't work either so now I probably need to understand better what is going on. Hence this blog entry.

Here's how I have the resources configured (as per the best practice google found for me): 

  • Build Action: Embedded resource
  • Copy to output directory: do not copy
  • Custom tool: PublicResXFileCodeGenerator

The fact there is a custom tool here leads me still to think recompilation is needed. A little more about the tool is here and here.

After which I had another "doh!" moment and came thought that I should simply copy the corresponding designer file as well as this is where the property will be accessed and the IDE is handling this for me. In which case I will then also need to force recompilation.

But no, still not working. What have I missed? Ok, so checking the bin directory there is also an xml file containing data relating to the resources. Let's try that as well. Hmmm, nope. Forcing recompilation one more time. Still no joy.

Ok so let's takea look with reflector - the resources are part of the assembly. So let's grab the deployed assembly (which is of identical size) and see if I can access the resources directly within it - they should be the old versions. They are. So the resources are literally embedded in the assembly but simply copying the related files up to the server and forcing a recompilation doesn't do all that is necessary to update the resource references, presumably due to this additional custom tool which Visual Studion integrates with but isn't part of the standard .NET compilation process? So I can just copy up the dll compiled locally. Which worked. Got there at last.

In my book this isn't ideal however and does raise the issue as well that maintenance life becomes a little more complex when you move to resource files, at least with this configuration. When/ if I get a chance I might have a play with other configurations. In the meantime, others have looked at already.

Windows Phone 7.8 update issues

4. February 2013 09:16 by Chris in Windows Phone  //  Tags:   //   Comments (0)

I installed Windows Phone 7.8 over the weekend. It has not gone smoothly. First Zune refused to recognise the phone - it did eventually - and this morning my Nokia 800 locked for the first time ever and I had to google a soft reset which worked thankfully, from here: "Press and hold the Volume down and Power buttons until it vibrates, after that you have to release all the keys then phone will vibrate 3 times." This happened while playing a podcast. I have had issues with the media player in the past, chiefly it not maintaining the state of where I was in the podcast, but nothing this major.

Here's hoping for few further issues with 7.8 which, by the way, doesn't seem to add a great deal to 7.5. So I might be googling how to rollback to 7.5 in the not too distant future if the problems persist. Not to downplay the complexity of any development when Microsoft is effectively supporting 2 platforms but 7.8 has been so long in developing one would have though they could have got it right. Too many issues and my loyalty to Windows Phone will be severely tested.

 

 

About the author

I am Dr Christopher Sully (MCPD, MCSD) and I am a Cardiff, UK based IT Consultant/ Developer and have been involved in the industry since 1996 though I started programming considerably earlier than that. During the intervening period I've worked mainly on web application projects utilising Microsoft products and technologies: principally ASP.NET and SQL Server and working on all phases of the project lifecycle. If you might like to utilise some of the aforementioned experience I would strongly recommend that you contact me. I am also trying to improve my Welsh so am likely to blog about this as well as IT matters.

Month List