• Archive,  Uncategorized

    Sometimes they come back

    Stephen King fans like me for sure know Night Shift, a collection of 19 short stories I first read almost (oh, my…) almost 20 years ago. In Italian the title of this collection has been translated as “A volte ritornano” which literally means Sometimes they come back. This is exactly what I thought yesterday when I got yet another version of the “503 Service Unavailable” error: after I have already written about this error here and here, I’m writing the third post about it. I’m wondering if I’ll end up with a 19 post collection as Night Shift has… 😏 Anyway, here’s the new story: the application pools of this web server were failing with the following error (eventid 281) The worker process for application pool ‘MSExchangeOWAAppPool’ encountered an error ‘Unrecognized attribute ‘precondition’ trying to read global module configuration data from file ‘\\?\C:\inetpub\temp\apppools\MSExchangeOWAAppPool.config’, line number ‘281’.  Worker process startup aborted. As you can see the precondition keyword is mistyped (it should be preCondition, capital “C”) and if we changed the .config file mentioned in the error message we were able to start our application pool but randomly (most of the time after a reboot, though) the problem came back. Interesting…

  • Archive,  Uncategorized

    My GridView does not want to paginate anymore!

    Lots of stuff kept me busy over the last few months and this blog has been a bit too quiet… let me try to revamp it a bit (new graphic layout will come later). I recently worked on an interesting case where a simple GridView with pagination enabled was not working as expected: every time we clicked a different page (note, page referred to the GridView pages, not .aspx pages…) we were quickly brought back to the first page: no errors logged anywhere (IIS logs, Fiddler, event viewer… nothing really useful there). Then we decided to make a quick test: we bypassed the ISA proxy and everything started working fine, no way to reproduce the problem again; needless to say, as soon as we reconfigured the proxy in IE the problem came back. My colleague Alvar works also on ISA cases and suggested the article POST requests that do not have a POST body may be sent to a Web server that is published in ISA Server 2006 and this actually did the trick, problem solved! Thanks Alvar ? Carlo Quote of the day: Great people talk about ideas, average people talk about things, and small people talk about wine.…

  • Uncategorized

    HashTable insert failed. Load factor too high

    I already encountered a few recurrences of this errors and every time it has been a torture to capture a correct set of data (especially memory dumps) to review because this usually happens sporadically and you could have to wait weeks if not months before getting it again. There are a couple of hotfix available for this error message (see http://support.microsoft.com/default.aspx?scid=kb;EN-US;831730 and http://support.microsoft.com/default.aspx?scid=kb;EN-US;893314) but you already have them if you’re on the latest Service Pack for the .NET Framework. Unless you’re using HashTable objects yourself… If that’s the case you might be running into a race condition which leads to the error, so you might want to consider to use the following code to synchronize the HashTable using SyncLock: Dim MyHashTable as new Hashtable() SyncLock MyHashtable.Syncroot MyHashtable.Add (myKey, myValue) End SyncLock As an alternative you can use the Hashtable.Synchronized() method to return a synchronized (thread-safe) wrapper for the HashTable object.   Carlo Quote of the day: Everyone is a genius at least once a year. The real geniuses simply have their bright ideas closer together. – Georg Christoph Lichtenberg

  • Uncategorized

    Visual Studio 2008 SP1 and .NET 3.5 SP1 available for download

    Microsoft Visual Studio 2008 Service Pack 1 (exe) This download installs Visual Studio 2008 Service Pack 1 (SP1) and the .NET Framework 3.5 SP1. SP1 addresses issues that were found through a combination of customer and partner feedback, as well as internal testing. These service packs offer Visual Studio and .NET Framework users improvements in responsiveness, stability and performance. Click here for more information regarding about these service packs. Microsoft .NET Framework 3.5 Service Pack 1 .NET Framework version 3.5 Service Pack 1 provides the following new features and improvements: ASP.NET Dynamic Data, which provides a rich scaffolding framework that enables rapid data driven development without writing code, and a new addition to ASP.NET AJAX that provides support for managing browser history (back button support). For more information, see What’s New in ASP.NET and Web Development. Core improvements to the CLR (common language runtime) that include better layout of .NET Framework native images, opting out of strong-name verification for fully trusted assemblies, improved application startup performance, better generated code that improves end-to-end application execution time, and opting managed code to run in ASLR (Address Space Layout Randomization) mode if supported by the operating system. Additionally, managed applications that are opened…

  • Uncategorized

    Again on public hotfix download

    I already touched the subject in a couple of previous posts and replying to direct comments and question I got, and to confirm that we’re doing something (hopefully in the right way ?) on this matter I want to highlight this news from Jeff: Migrating hotfixes to MSDN Code Gallery. The essence is that Visual Studio, .NET and other technologies hotfixes can be downloaded directly from http://code.msdn.microsoft.com/Project/ProjectDirectory.aspx?ProjectSearchText=hotfix and start a discussion with other people on the matter, hope you’ll find this useful (and keep the feedback coming of course). Carlo Quote of the day: The reason lightning doesn’t strike twice in the same place is that the same place isn’t there the second time. – Willie Tyler

  • Uncategorized

    Need to print from a x64 machine? Can you wait 60 seconds?

    I guess some of you might have developed a web application which, among other functionalities, prints some kind of report; and sooner or later you might consider to move the application to a 64 bit machine. At this is what this customer did. They had this ASP.NET application which allows the user to run some queries on a backend database and then print the result on a network printer connected to the web server; under some circumstances the application was hanging for 60 seconds (always 60 seconds) before timing out; of course everything was running fine on a 32 bit machine (i.e. we never managed to reproduce the issue there). At the beginning we thought to some kind of network timeout on the customer’s network or a configuration problem on the server (the application is quite complex so was not possible to have a repro to run and debug on my machine), and this was partially confirmed by a hang dump which showed some error messages about the printer, but this was not consistent enough to get a clue. What was consistent was the use of winspool.dll ntdll!NtDelayExecution(void)+0x15 kernel32!SleepEx(unsigned long dwMilliseconds = 0x3e8, int bAlertable = 0)+0x68 kernel32!Sleep(unsigned long dwMilliseconds…

  • Uncategorized

    The error indicates that IIS is not installed on the machine. Please install IIS before using this tool

    Yesterday I was working on a sample project got from a customer, when Visual Studio 2005 showed this dialog: Ok I thought, let’s fix the application mappings. I did, but got the following: What? Are you kidding me? ? Of course IIS is installed, I’m using it every day… But wait a minute, I’m running on Vista x64 and this rings a bell to me… Let’s use the x64 Visual Studio command prompt and give it another try: Much better… and now Visual Studio does not complain anymore! ? Carlo Quote of the day: We are inclined to believe those whom we do not know because they have never deceived us. – Samuel Johnson

  • Uncategorized

    Visual Studio designer, CodeDom and InitializeComponent()

    The code problem A few days ago I had the chance to work on a case not concerning ASP.NET or IIS, but rather an interaction with Visual Studio designer with classes from System.CodeDom namespace. The customer was developing a custom control meant for other developers to use it in their projects, and upon adding the control to the form, the former had to automatically modify the some codebehind files for example to add some custom methods and register itself in the InitializeComponent method to add events etc… The problem was that we were able to add new methods to the form, but despite our attempts nothing was added to InitializeComponent ? Here’s the chunk of code we were using: private void AddCode(Form form) { IDesignerHost host = null; host = (IDesignerHost)form.Site.GetService(typeof(IDesignerHost)); //Add method "Form1_Load" on Form1 //--------------------------------------------------------------------------- CodeMemberMethod member = new CodeMemberMethod(); member.Name = "Form1_Load"; member.Parameters.Add(new CodeParameterDeclarationExpression("System.Object", "sender")); member.Parameters.Add(new CodeParameterDeclarationExpression("System.EventArgs", "e")); CodeSnippetExpression sn; sn = new CodeSnippetExpression("MessageBox.Show(\"Hello world\")"); member.Statements.Add(sn); member.Attributes = MemberAttributes.Private; CodeTypeDeclaration typedecl = (CodeTypeDeclaration)form.Site.GetService(typeof(CodeTypeDeclaration)); typedecl.Members.Add(member); //--------------------------------------------------------------------------- //This code will add the following line to the "InitializeMethod" method // this.Load += new System.EventHandler(this.Form1_Load); //--------------------------------------------------------------------------- member = new CodeMemberMethod(); foreach (CodeTypeMember typememb in typedecl.Members) { if (typememb.Name == "InitializeComponent") {…

  • Uncategorized

    HTTP error 406 with .NET Framework 3.0

    I got a couple of cases about this problem recently… Imagine this scenario: you install the .NET Framework 3.0 on your client, and then browse an ASP.NET based web site; you get a 406 HTTP return code from the web server, which means “Client browser does not accept the MIME type of the requested page” (see IIS status codes). Uninstalling the .NET Framework 3.0 corrects the problem, and you’re finally able to successfully browse the site. The problem proved itself in two different ways and apparently for two different reasons, but the underlying cause was actually the same. The 406 return code also means that any of the configuration limits has been reached, and digging into IIS logs we found that the problem was actually due to the length of the “Accept” header which has a limit of 256 bytes. Installing the .NET Framework 3.0 you receive support for a few additional file formats, here is how it looks the Accept header on Windows Vista (where the .NET Framework 3.0 is preinstalled): Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-ms-application, application/vnd.ms-xpsdocument, application/xaml+xml, application/x-ms-xbap, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, application/x-shockwave-flash, */* In this case there was a custom ISAPI extension which was actually filtering the…

  • Uncategorized

    Gacutil not supported on production?

    The other day I got an interesting question from a customer: We are documenting how our production assemblies should be deployed on our production servers. At first we wanted to deploy shared assemblies through the gacutil.exe utility. By reading this article we realized that Microsoft’s recommendation is to use gacutil in a development environment but that it should not be used to deploy assemblies in production. This raises the following questions: How should we deploy our assemblies in production? Why not gacutil? Any alternative to MSI? The customer was referring to this note box: The reason is explained in this article: In deployment scenarios, use Windows Installer 2.0 to install assemblies into the global assembly cache. Use Windows Explorer or the Global Assembly Cache tool only in development scenarios, because they do not provide assembly reference counting and other features provided when using the Windows Installer. The preferred installation method is a MSI package, but using the appropriate command line switches you can still use gacutil as described in http://msdn2.microsoft.com/en-us/library/ex0ss12c(vs.80).aspx: Gacutil.exe provides options that support reference counting similar to the reference counting scheme supported by Windows Installer. You can use Gacutil.exe to install two applications that install the same assembly;…