Perfmon is likely the first tool you think to when it comes to monitor some internals and performance of your application and it’s relatively easy to find out information and resources on the Internet; unfortunately this seems to also be a fragile component and every now and then we receive new calls about it: event log spammed with warnings about missing or corrupted counters, values returned are inconsistent or clearly wrong etc… Messages like the following can appear after for example installing the .NET Framework 2.0 on your machine: The Open Procedure for service "ASP.NET" in DLL "C:\Windows\Microsoft.NET\Framework\v2.0.50727\aspnet_perf.dll" failed. Performance data for this service will not be available. Status code returned is data DWORD 0 To note that such warnings are logged even if your application is not running. Some troubleshooting First of all you can try to disable any third party services and processes (for example using msconfig.exe or Autoruns) and see if the problem still reproduces. If it does, you can use How to manually rebuild Performance Counter Library values to try to fix it manually, or try the following: Uninstall the .NET Framework 2.0 If available for Perfc009.dat, Perfh009.dat and Perfh007.dat , Perfh007.dat, backup the registry keys…
-
-
LogParser & event logs on Vista/Windows 2008
I was discussing this morning with a customer, here’s a useful reminder to this post if you need to deal with “legacy” .evt logs on Vista/Win2008. wevtutil epl application.evt application.evtx /lf:true CarloQuote of the day: That’s the secret to life… replace one worry with another…. – Charles M. Schulz
-
WMI warnings 35 and 40 with ASP.NET
Over the past couple of weeks I got to almost identical cases where the customer had the event log on their servers “spammed” by the following messages: Event Type: Warning Event Source: WinMgmt Event Category: None Event ID: 40 Date: <date> Time: <time> User: N/A Computer: <computername> Description: WMI ADAP was unable to create the object Win32_PerfRawData_ASPNET_2050727_ASPNETAppsv2050727 for Performance Library ASP.NET_2.0.50727 because error 0x80041001 was returned Event Type: Warning Event Source: WinMgmt Event Category: None Event ID: 35 Date: <date> Time: <time> User: N/A Computer: <computername> Description: WMI ADAP was unable to load the ASP.NET_2.0.50727 performance library because it returned invalid data: 0x0 Article How to troubleshoot WinMgmt-based performance counter errors does not help in this case (we do not have Event ID 37, 41 or 61). The fix for this problem was scheduled to be added in .NET 3.5 SP1 (as also explained in this post) then we decided to ship a standalone hotfix too: the KB article is not yet available but you can request the fix (which by the way resolved both my cases) to CSS as usual, asking for 951683. Carlo Quote of the day: Always do right. This will gratify some people and…
-
Select date ranges with LogParser
Here’s an addendum to my previous LogParser collection of scripts: how can we filter our IIS logs folder to extract only the events happened in a certain time range? logparser “select * into 27.5.log from med*.log where to_timestamp(date,time) between timestamp(‘2008/05/27 10:11:00’, ‘yyyy/MM/dd hh:mm:ss’) and timestamp(‘2008/05/27 10:13:00’, ‘yyyy/MM/dd hh:mm:ss’)” -i:iisw3c -o:nat -rtp:-1 Note I’m using the to_timestamp conversion to combine date and time fields from the IIS log and compare to the date range I’m interested in. CarloQuote of the day: The important thing in science is not so much to obtain new facts as to discover new ways of thinking about them. – Sir William Bragg
-
Switch thread using the ThreadID
Quick hint for today: how do you switch the thread you’re examining in Windbg? If you know the thread number you can type the command ~<thread number>s (e.g. ~21s to switch to thread 21). But what about if you only know the ThreadID (which is an hexadecimal value)? For example if you examine the output of the !lock command: 0:000> !locks CritSec mscorwks!ThreadpoolMgr::WorkerCriticalSection+0 at 7a393800 WaiterWoken No LockCount 21 RecursionCount 1 OwningThread 26a0 EntryCount 0 ContentionCount 15 *** Locked What thread is 26a0? Well… you can display all available threads (with the managed !sos.threads command or the native ~ [tilde] command) and then manually look for the ID, or use the following: 0:000> ~~[26a0]s eax=000057b4 ebx=00000000 ecx=79f40a2b edx=18926823 esi=000e194c edi=000006c4 eip=7c82ed54 esp=02d2fbf0 ebp=02d2fc2c iopl=0 nv up ei pl zr na pe nc cs=001b ss=0023 ds=0023 es=0023 fs=003b gs=0000 efl=00000246 ntdll!KiFastSystemCallRet: 7c82ed54 c3 ret ~~[<threadID>]s (e.g. ~~[26a0]s), and with the sample above Windbg will switch to thread 21 ? Carlo Quote of the day: Knowledge is power, if you know it about the right person. – Ethel Mumford
-
Are you using safe Http Headers?
There are a variety of web applications out there which are relying on http headers for different purposes: automatic redirection, streaming a binary file to the client, controlling how content is cached on the client, adapting the site’s functionalities and interface to the capabilities of the browse and a lot more I’m sure you can think to. If you’re upgrading to ASP.NET 2.0 (or higher) an existing application which relies on http headers, you might encounter some problems, especially in the case you’re producing binary context (say a PDF file) to your clients: corrupted file, or type not supported, or inability to print the downloaded document are some of the symptoms you may get. First, check your code if you have something like the following: Response.ContentType = "application/pdf"; Response.AppendHeader("Content-Disposition", "attachment; filename=document.pdf"); Response.AddHeader("Content-Length", m.GetBuffer().Length.ToString()); ObjPdf writer = ObjPdf.getInstance(document, m); document.Open(); Try changing it to this: Response.ContentType = "application/pdf"; Response.AppendHeader("Content-Disposition", "attachment; filename=document.pdf"); ObjPdf writer = ObjPdf.getInstance(document, m); document.Open(); Response.AddHeader("Content-Length", m.GetBuffer().Length.ToString()); If m.GetByffer().Length is zero then you have a problem, so it’s important to open the writer object before adding the header. useUnsafeHeaderParsing If that’s enough or you don’t want to change your code (maybe because too many pages are affected) then you…
-
“Invalid postback or callback argument” in ASP.NET
I saw this error twice recently, but as often happens for two completely different cases so here they are, hope it helps someone to same their time… Invalid postback or callback argument. Event validation is enabled using <pages enableEventValidation="true"/> in configuration or <%@ Page EnableEventValidation="true" %> in a page. For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them. If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation Nested forms The first problematic application was dynamically building page layout and manipulating the HTML stream sent to the client; in my specific case there was some manipulation carried on the client through Javascript, but I think the same may happen if for example the HTML stream is changed through an HttpHandler after the main ASP.NET processing has been completed. The page was rendered correctly within the browser, but a postback thrown the exception above and this was due to a malformed page structure, where we had nested <form> tags like in the following example: <body> <form id="form1" runat="server"> <div> <asp:Button ID="Button1" runat="server" Text="Button" /> <form></form> </div>…
-
When Vista denies you access to “your” files…
For my work I have two desktops and a laptop I always bring with me, and despite all the online synchronization tools out there (SkyDrive, FolderShare, Groove, Mesh etc…) I’m used to SyncToy to keep my important files and folders updated across the three machines; The same is true for my backup .pst files: the laptop is my main machine, I usually make my changes and archives there and then copy the pst on the other two machines. But since Vista (and now also with Windows 2008) when I copy the new file and then try to load the data file in Outlook, I always get an access denied error: Clearly a permission issue and running Outlook with elevated privileges resolves the problem; but explicitly granting Full Control to my account (by the way, I’m member of the Administrators group), taking ownership of the file etc… is not enough, I was still unable to open the file (and I don’t want to run Outlook as Administrator). After many attempts as a last resource I tried to create through Outlook a new empty pst file with the same name of my archive one, and then I overridden it the file I…
-
Missing ASP.NET Tab in IIS Management Console (the solution)
Remember this problem? Well, Tom (and Jeremy and Vandana) has a solution? Carlo Quote of the day: There is no abstract art. You must always start with something. Afterward you can remove all traces of reality. – Pablo Picasso
-
Disable recycling in IIS 7? Use AppCmd
I stumbled on this while trying to repro a remote debug problem for a customer: as you might know from this post from Johan, debugging ASP.NET on IIS7 needs some special care about the application pool recycling policy otherwise if you’ll not be fast enough IIS will kill your process. Well, I was doing some tests and wanted to disable the Regular Time Interval value through the IIS Manager (default for this property is 1749 minutes, i.e. 29 hours): But if you try to set the value to zero, I’ll get an error message (at least in Windows 2008 RTM). Luckily we can still use AppCmd to change our config store, here it is how: appcmd.exe set AppPool <AppPoolNameHere> /recycling.periodicRestart.time:00:00:00 And if you now go back to the UI you’ll see the change correctly reflected Of course you can manually change your applicationHost.config file, but handle it with care and be sure you always have a backup first! appcmd add backup <BackupNameHere> Use the Administration Pack It’s still a preview as of now, but it contains some really interesting new features for the IIS Manager. For example you can select the server node within the Connections left panel and under…