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
-
-
Does hot deployment really means “HOT”?
Every now and then we get calls from customer having troubles with ASP.NET deployment, usually in cluster/NLB environment but sometimes also in single servers; what they usually have in common is the complexity of the web application, maybe made of dozens (if not hundreds) of pages, controls etc… Typical questions are: I am deploying my new pages and dlls but then suddenly the application is restarted, and my user lose their work and have to login again After the deployment the application is slow at startup In my NLB I randomly get inconsistent behaviors and weird exceptions we never got before We are using a tool to synchronize files and folders, and during the sync for a few seconds we receive a lot of errors telling that some dlls are not available, but after some more seconds everything is running fine again There are a few variations to the above, but you got the point. I think this might be due to a misunderstanding (of should I say the documentation is not clear enough?) about deployment capabilities of ASP.NET and what is recommended for complex/full loaded applications; the point is that ASP.NET supports hot deployment meaning that whenever you update…
-
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") {…
-
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…
-
Procmon on x64? “/?” will help :-)
Maybe some of you already know this trick, but if you don’t… here it is I’ve been running a Vista x64 as my main machine in office for a few months now, and when I had to analyze a Process Monitor trace received from a customer, but if the log was coming from a x86 machine (that’s still the most common for customer calls we see today) I was not able to open it on my desktop, and always had to rely on my laptop (where I run Windows XP Pro) or on my second desktop (Windows 2003). I took this for granted for a while, but then this morning I thought to have a look at the command line options (procmon /?) and got a nice surprise: Tried it, and (of course) I was finally able to open the 32bit trace on my 64bit machine.. ? Carlo Quote of the day: It’s amazing that the amount of news that happens in the world every day always just exactly fits the newspaper. – Jerry Seinfeld
-
A Trappable error C0000005 occured in an external object, the script cannot continue running
This is an Access Violation exception which can have different causes (MDAC bad installation, third party components such as Oracle dlls which Oracle has a fix for etc…), but in the specific case I had some time ago this was due to a corrupted Windows Scripting Host engine. This was a classic ASP application and it was crashing randomly; we captured a dump with adplus (4 dumps, actually) and the stack of the faulting thread was always the same: 0:020> kpL2000 ChildEBP RetAddr 04f5f5c8 7346520b vbscript!VarStack::SetMasterSp(long cvar = 6, class VAR ** ppvarSp = 0x04f5f6b8)+0xa3 04f5f5e4 7346492e vbscript!CScriptRuntime::Init(class CSession * psess = 0x00000000, class FncInfo * pfin = 0x04654e28, class VAR * pvarThis = 0x00000000, int cvar = 0, class VAR * prgvar = 0x00000000, unsigned long grfcall = 0)+0x265 04f5f6f0 73464cd2 vbscript!CScriptEntryPoint::Call(class VAR * pvarRes = 0x00000000, int cvar = 0, class VAR * prgvar = 0x00000000, class VAR * pvarThis = 0x00000000, unsigned long grfCall = 0)+0x4a 04f5f748 73465522 vbscript!CSession::Execute(class IEntryPoint * pep = 0x04654e20, struct tagVARIANT * pvarRes = 0x00000000, int cvar = 0, struct tagVARIANT * prgvar = 0x00000000, struct tagVARIANT * pvarThis = 0x00000000, unsigned long grfscr = 0)+0xb4 04f5f798 7346189b vbscript!COleScript::ExecutePendingScripts(struct tagVARIANT * pvarRes…
-
.NET Runtime 2.0 Error, Event id:5000
This error message was reported by a customer last week; every day, randomly, his application pools (on two servers in NLB) were restarted during business hours without an apparent reason, and of course users were complaining because of lost sessions etc…; the following entry was added to the Application event log: Event Type: Error Event Source: .NET Runtime 2.0 Error Reporting Event Category: None Event ID: 5000 Date: 9/28/2005 Time: 3:18:02 PM User: N/A Computer: IIS-SERVER Description: EventType clr20r3, P1 w3wp.exe, P2 6.0.3790.1830, P3 42435be1, P4 app_web_7437ep-9, P5 0.0.0.0, P6 433b1670, P7 9, P8 a, P9 system.exception, P10 NIL The first thing to do when we have a specific error message is to search the Knowledge Base for known issues/hotfixes etc…, and was quite easy to find the article Unhandled exceptions cause ASP.NET-based applications to unexpectedly quit in the .NET Framework 2.0 which I already used more than once in the past to resolve similar issues; I usually suggest the customer to first apply the solution described in “Method 2”: Method 2 Change the unhandled exception policy back to the default behavior that occurs in the .NET Framework 1.1 and in the .NET Framework 1.0. Note We do not recommend…
-
Take control over Windbg
If you’re like me and most of my colleagues in Customer Service and Support, you’ll probably spend a good deal of time in your debugger, which for me is WinDbg. So, since I’m in love with keyboard shortcuts (a colleague of mine likes kidding me stealing my mouse since I hardly use it, and every now and then uses me as his personal “shortcut reference” ?) and always searching for “productivity tips” to optimize my workflow. Windbg has a few of them, here is what I use. Automate WinDbg startup I first discovered this in this post from Tess and then customized it to match my needs, especially on my Vista x64 machine; basically this is a .reg file set WinDbg as the default application for .dmp files, and adds a few entries to the right click menu to chose different options. I also have to say that on my x64 machine I actually have two separate folders for WinDbg 32bit and 64bit, so that depending on the dump I’m debugging I can use the right tool: Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\.dmp] @="Debugger.Dump" [HKEY_CLASSES_ROOT\Debugger.Dump\DefaultIcon] @="c:\\debuggers x86\\cdb.exe" [HKEY_CLASSES_ROOT\Debugger.Dump\Shell\Debug_1_1_x86] @="Debug This Dump for .NET 1.1 x86" [HKEY_CLASSES_ROOT\Debugger.Dump\Shell\Debug_1_1_x86\Command] @="\"C:\\debuggers x86\\windbg\" -z \"%1\"…
-
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;…
-
Ok, now how do I capture my dump?
Now we know how it started, some basic information and terminology and why symbols are important, it’s now time to capture our first dump. How? When? Using which tool? It depends… ? From the second post of this series we already know the difference between a hang and a crash dump and depending on the problem we are troubleshooting we know which one we need. There are different ways to capture such a dump but the most used tool in CSS is adplus, and specifically in the IIS and Internet Development team (which I belong to, by the way ?) we also use DebugDiag. I personally prefer adplus, I like it to be run at the command line and be highly configurable through its .cfg files, but there are circumstances (especially unmanaged memory leaks and hanging web applications where the customer can’t be always monitoring the server to readily capture a manual hang dump with adplus) where I find DebugDiag quite useful. Let’s see the differences. Adplus.vbs Adplus is essentially a VBScript (quite large, more than 5.000 lines) file which helps you capture a dump and it accepts some arguments at the command line (or it’s also possible to use…