First time here? Check out the site's "greatest hits" or read a post from the archives. Feel free to leave a comment or ask a question, and consider subscribing to the latest posts via RSS or e-mail. Thanks for visiting!
Do you Tweet? Follow me on Twitter @shanselman or learn how to use Twitter!
Page 1 of 34 in the Bugs category Next Page

Joe Lowrance said, er tweeted, it best when he said,

"the amount of attention ELMAH hasn't got is shocking."

ELMAH is one of those largely unknown and deeply awesome .NET Open Source projects that should be part of ASP.NET proper.

What is ELMAH?

I like to say that ELMAH is Tivo for your ASP.NET Errors. You can get your Yellow Screens of Death, with full call-stack back and analyze what's really happening. It's Exception Driven Development. What's it really do?

Once ELMAH has been dropped into a running web application and configured appropriately, you get the following facilites without changing a single line of your code:

  • Logging of nearly all unhandled exceptions.
  • A web page to remotely view the entire log of recoded exceptions.
  • A web page to remotely view the full details of any one logged exception.
  • In many cases, you can review the original yellow screen of death that ASP.NET generated for a given exception, even with customErrors mode turned off.
  • An e-mail notification of each error at the time it occurs.
  • An RSS feed of the last 15 errors from the log.
  • A number of backing storage implementations for the log, including in-memory, Microsoft SQL Server and several contributed by the community.

Created by Atif Aziz (@raboof on Twitter) and Scott Mitchell, ELMAH means is "Error Logging Modules and Handlers" and has been rocking my world since, well, September of 2004.

(Small Correction, Scott Mitchell helped writing the original MSDN article. ELMAH is 100% conceived of by Atif.)

From the project site:

ELMAH (Error Logging Modules and Handlers) is an application-wide error logging facility that is completely pluggable. It can be dynamically added to a running ASP.NET web application, or even all ASP.NET web applications on a machine, without any need for re-compilation or re-deployment.

ELMAH is wonderful for many reasons. First, because it just works. Second, because it's a fantastic example of effective use of HttpModules and HttpHandlers working together. Third, because it's been design with enough thought that nearly anything you'd want from it for use in a production site is there.

I'm sitting here in a cafe and I'm going to add ELMAH to the ASP.NET MVC-based NerdDinner.com Source Code. Actually, the site, as I don't need to recompile the source if I'm not doing anything tricky. ;)

Implementing ELMAH on your ASP.NET (MVC or otherwise) Site 

I download ELMAH, and I put its DLL in my /bin folder (or wherever you like to put libraries). ELMAH doesn't need to be referenced by your project directly if you don't want to. Ultimately it just needs to be in your bin folder so it can be found. You can put it in /lib and make a build event if you like, as long as it ends up in /bin.

Then I open up two instances of notepad and copy over a few HttpHandlers and HttpModules into my existing web.config. Tedious, but straightforward.

Where you put these depends on if you're using IIS6 or IIS7, but the general idea is the handlers looks like this:

<handlers>
....
<add name="Elmah" verb="POST,GET,HEAD" path="elmah.axd" preCondition="integratedMode" type="Elmah.ErrorLogPageFactory, Elmah"/>
....
</handlers>

and the modules looks like this:

<modules runAllManagedModulesForAllRequests="true">
...
<add name="ErrorMail" type="Elmah.ErrorMailModule, Elmah"/>
<add name="ErrorLog" type="Elmah.ErrorLogModule, Elmah"/>
<add name="ErrorFilter" type="Elmah.ErrorFilterModule, Elmah"/>
...
</modules>

You can pare it down a bit if you don't need ErrorMail, for example. Then, I hit my site at http://localhost:xxxx/elmah.axd and I get this Error log, similar to what you'd see via Trace.axd.

Error log for  on HANSELMAN-T60P (Page #1) - Windows Internet Explorer

Ok, no errors. Let's make some. I'll visit some messed up URLs and intentionally cause trouble...here's what ELMAH says now:

Error log for  on HANSELMAN-T60P (Page #1) - Windows Internet Explorer (2)

And I can drill down and see the Yellow Screen of Death (YSOD) as it "would have been."

Error System.ArgumentException [5] - Windows Internet Explorer

Now, this assumes my ASP.NET MVC site has no error handling to speak of. ELMAH is watching for unhandled exceptions and recording them, holding them in memory. I can also setup logs to SQL Server or VistaDB or SQLLite so they'll live beyond application recycles.

You can certainly secure access to the ELMAH pages. You can also pull the errors into your favorite RSS Reader, which is a killer feature, IMHO.

Making ELMAH work with ASP.NET MVC's "HandleError" Attribute

In ASP.NET MVC there's an attribute called [HandleError] that will grab anything that goes wrong inside your controllers and show the ~\Shared\Error.aspx View. However, because it "handles" the error, it hides it from ELMAH. Remember that [HandleError] is a declarative try/catch. In my case, I want to have ELMAH handle it.

There's two ways around this.

One, I made a method in my Controller like this:

public ActionResult Trouble()
{
return View("Error");
}

In my web.config, I have a customErrors section like this:

<customErrors mode="On" defaultRedirect="/Dinners/Trouble">
<error statusCode="404" redirect="/Dinners/Confused" />
</customErrors>

This sends folks to /Dinners/Trouble which shows the Error page, after ELMAH takes care of it.

Second, as an advanced technique, I could write my own derived HandleErrorWithELMAHAttribute that logs the error using ELMAH's API, then passes the exception up to the default handler with ASP.NET MVC.

UPDATE: Looks like Dan Swatik was coincidentally doing a similar thing error this morning! What's nice about the solution on Dan's Blog, is that it was written with the help of Atif Aziz himself! (Remember, Atif's The primary author of ELMAH!) Here's the StackOverflow question.

My naive solution is below, but Atif's is better as it signals the error to ELMAH's pipeline rather that logging directly as mine does. Here's the more correct version:

namespace MvcDemo
{
using System;
using System.Web;
using System.Web.Mvc;
using Elmah;

public class HandleErrorAttribute : System.Web.Mvc.HandleErrorAttribute
{
public override void OnException(ExceptionContext context)
{
base.OnException(context);

var e = context.Exception;
if (!context.ExceptionHandled // if unhandled, will be logged anyhow
|| RaiseErrorSignal(e) // prefer signaling, if possible
|| IsFiltered(context)) // filtered?
return;

LogException(e);
}

private static bool RaiseErrorSignal(Exception e)
{
var context = HttpContext.Current;
if (context == null)
return false;
var signal = ErrorSignal.FromContext(context);
if (signal == null)
return false;
signal.Raise(e, context);
return true;
}

private static bool IsFiltered(ExceptionContext context)
{
var config = context.HttpContext.GetSection("elmah/errorFilter")
as ErrorFilterConfiguration;

if (config == null)
return false;

var testContext = new ErrorFilterModule.AssertionHelperContext(
context.Exception, HttpContext.Current);

return config.Assertion.Test(testContext);
}

private static void LogException(Exception e)
{
var context = HttpContext.Current;
ErrorLog.GetDefault(context).Log(new Error(e, context));
}
}
}

Below is my naive version.

I made this HandleErrorWithELMAHAttribute:

public class HandleErrorWithELMAHAttribute : HandleErrorAttribute
{
public override void OnException(ExceptionContext filterContext)
{
try
{
var context = HttpContext.Current;
Error error = new Error(filterContext.Exception, context);
ErrorLog log = ErrorLog.GetDefault(context);
string id = log.Log(error);
}
catch (Exception localException)
{
//
// IMPORTANT! We swallow any exception raised during the
// logging and send them out to the trace . The idea
// here is that logging of exceptions by itself should not
// be critical to the overall operation of the application.
// The bad thing is that we catch ANY kind of exception,
// even system ones and potentially let them slip by.
//

Trace.WriteLine(localException);
}

base.OnException(filterContext);
}
}

Then I put the attribute on my ASP.NET MVC Controller like this:

[HandleErrorWithELMAHAttribute]
public class DinnersController : Controller {
...

Either way works, I actually kind of prefer the first one, although it requires a controller to have an essentially empty method to send folks to the shared error page. I keep the /Confused and /Trouble methods in there as I think it makes the site more personal.

Anyway, ELMAH rocks and you should use it today. Phil Haack loves ELMAH too! Jeff and the guys at StackOverflow use ELMAH also, albeit a "custom fork." (Release your code, Jeff!)

Time for me to to donate some money to the ELMAH Open Source efforts.

Related



The .NET Framework 3.5 SP1 included a bunch of new features, but as a Service Pack it also included a number of bug fixes and many improvements. These fixes included all aspects of the .NET Framework from ASP.NET to WPF and the CLR.

Will the .NET Framework 3.5 SP1 break my 2.0 apps?

Almost certainly not.

Why Not?

Remember that 3.5 (and 3.0 before it) all have the 2.0 CLR at their core. If you want excessive detail on this, I've got it. Because the 2.0 CLR is the engine underneath and 3.0 and 3.5 are primarily additive*, there's inherently high application compatibility between these releases.

Realize that 2.0, 3.0 and 3.5 are not different products, no matter what anyone says. They are not different "Side By Side" releases, like 1.x and 2.0 were. They are evolutionary; if anything, our naming could have been better (you think?), but rather each adds functionality to the one before it. They are really additive releases to the same core product.

But, I've hit an edge case…

We’re committed to application compatibility. However you may have heard or reported issues or bugs around 3.5 SP1 and I’ll go into how we’re dealing with those below. Most of these are corner-case/edge-case situations.

It may be cold comfort when it’s your bug and your company and it sounds like a marketing line, but it’s true. There are a lot of resources working to minimize impact to you.

I’ve now been on both sides, when working in a large ISV and trying to get a hotfix, and now on the inside trying to keep compatibility while keeping things secure and correct. There is a massive amount of unit and integration testing that goes into the .NET Framework (that includes all technologies under that umbrella).  That means that every effort is made not to break stuff. That’s why Visicalc still runs nicely on my Vista x86 machine (although I can’t run OS 9 apps on OS X anymore, interestingly ;) ) 

Software testing is a combinatorial problem, and as such all software has bugs, but sometimes when a bug comes back it’s called a “regression.” That means it was fixed before, and now it doesn’t. Sometimes folks call a new bug a regression their software worked before and it doesn’t now. This might be because they relied on an incorrect behavior that was later corrected, or that it was just a bug.

It IS possible that something could break, so as with all SP’s you should do compatibility testing to make sure you’re not hitting an edge case.  If you are affected by a bug at some point, we’re trying to get you a very fast response. Notice in the table below there’s a “How Found” column. You can report on Forums, contact PSS or use Connect to report bugs.

When will the .NET Framework 3.5 SP1 be pushed to Windows Update?

Later this year, probably November-ish, the .NET Framework 3.5 SP1 will begin show up on Windows Update in a rolling and throttled fashion so that all machines that have .NET 2.0 or higher will be automatically upgraded to 3.5 SP1.

If you’re an ISV or Hoster, you might be concerned that you’d wake up one day and find machines updated to 3.5 SP1 via Windows Update before these bugs are fixed.

There will be an update/patch made to .NET 3.5 SP1 before it goes live on Windows Update. We are holding SP1 on Windows Update (Microsofties call it “WU” or “Woo”) until this patch is finalized. 

That patch is called a GDR, or General Distribution Release, coming for .NET 3.5 SP1. A GDR is a Microsoft TLA (Three Letter Acronym) for an update that is for everyone. This update’s goal is to fix bugs that have been found in .NET 3.5 SP1. Many of these bugs were found by the community and reported on the Connect site.

We won’t push .NET 3.5 SP1 to WU until everyone feels confident it’s solid.

I know if you have a particular bug on Connect that you’re watching, you might be a little frustrated and be wondering what its status is. We’re working on getting the Connect Bugs updated and lots of folks (myself included) are trying at every turn to increase transparency. This blog post is an example. If they stop abruptly, I’ve finally been fired for them. ;)

Transparency

Sometimes your app might break and the issue isn’t “fixed,” but closed with “By Design” or “Workaround.” This can be frustrating (believe me, I know) but some fixes can break other things, and there’s always security to consider. In the near future I’m going to try to dig into some really icky details of a few of the more interesting bugs and get some color commentary on them. I’m going to encourage the other teams to do the same. I know the BCL team had a few interesting issues and have expressed an interested in digging in and blogging some wonky technical details.

If you don’t want a bunch of details, you can stop reading now.

Wonky Technical Details

In the interested on transparency, here’s some of the bugs I’m tracking for this GDR. Note you can find most, if not all, of these bugs/issues on Connect and each team will be updating those with as much details as they have. Watch the issues there for the most up-to-date information we've got. If you feel something isn't getting attention, let me know and I'll poke the right manager.

Title

Product Unit

Details

How Found

.NET 3.5 issue - Dynamic Data Issue

ASP.NET

Dynamic Data fails on Entity Framework data models that contain 1->0..1 and *->1 database relations with an error like "'System.Web.UI.WebControls.EntityDataSourceWrapper' does not contain a property with the name 'Orders.OrderID'". These types of relationships occur in many databases including Northwind and AdventureWorks.

The error is caused by a naming mismatch that Dynamic Data has with the wrapper objects being returned by the EntityDataSource. We have a temporary fix available at: http://www.codeplex.com/aspnet/Release/ProjectReleases.aspx?ReleaseId=16367 which replaces the data model provider with one that names the properties correctly.

3rd party Forum

Hidden files/folders inside App_Browsers are not ignored

ASP.NET

This customer applied FrontPage Server Extensions (FPSE) to the site.  Normal behavior is to add metadata files inside _vti_cnf folders for each file in the site.  Therefore, inside App_Browsers folder, after applying FPSE, we get a hidden folder called _vti_cnf that contains the file called BrowserFile.browser
Trying to parse that file will result in this error, since this is not a real .browser file, but instead just a metadata file.

The workaround for now is to delete _vti_cnf folder, but we'll fix this.

PSS DTS Issue

After installing .NET 3.5 SP1, a web site using a derived version of the UpdateProgress control may encounter the following exception: “A ProgressTemplate must be specified on UpdateProgress control with ID ‘id’.”

ASP.NET

In the .NET Framework 3.5, the UpdateProgress control enforced the requirement of a ProgressTemplate from its PreRender routine. A derived UpdateProgress control could subvert that requirement by overriding OnPreRender in the derived control, and avoiding calling base.OnPreRender. In the .NET Framework 3.5 SP1, the UpdateProgress control now uses CreateChildControls to instantiate the ProgressTemplate, causing the requirement to be enforced at a different point in the page life cycle, and preventing the OnPreRender technique from subverting the check.

Other

SGEN and Obsolete attribute

WCF

ASMX web methods do not return serialized results. What the customer does is to SGEN an assembly that contains some types with [Obsolete(IsError = true)].  What he sees is SGEN throwing an error and  refusing to generate a serialization assembly. 

Here is the message you get from SGEN:
Microsoft (R) Xml Serialization support utility
[Microsoft (R) .NET Framework, Version 2.0.50727.1432]
Copyright (C) Microsoft Corporation. All rights reserved.
Error: Unable to generate a temporary class (result=1).
error CS0619: 'SGenTest.Program' is obsolete: ‘Testing.'
error CS0619: 'SGenTest.Program' is obsolete: 'Testing.'

Other

.NET 3.5 SP1: JIT generates incorrect code in managed C++ edge case

CLR

This is caused by JIT optimization changes we made in 3.5SP1. We promote some fields to registers when we shouldn't. Limited to structs or classes with four or fewer scalar fields, none of which are managed object references.The scope is additionally reduced in that this bug only manifests when using the cpblk or initblk instructions, which are only emitted by the managed C++ compiler.The issue does apply to both JITted and NGEN'd code.

MSConnect

Obfuscated 1.1 assemblies may fail if they override certain methods in the Framework

CLR

1.1 code that used to run successfully on 2.0 will no longer run on 3.5 SP1 (throws a MissingMethodException).

The underlying problem is as follows. Let’s say you have a 1.1 Framework type that overrode a virtual method, then stopped overriding it in 2.0. This should not be a breaking change, because an implementation of the method still exists (somewhere earlier in the inheritance hierarchy). However, if a customer overrode that method, built against 1.1, then obfuscated the code, the obfuscated code no longer works when run against 2.0 SP2/3.5 SP1.

Obfuscators that are using undocumented techniques to accomplish their task tend to get broken when we optimize things. Workaround is to not obfuscate these few methods, usually by marking them with an attribute. Long term workaround is for the obfuscator to play nice.

3rd party Forum

How .Net 3.5 SP1 broke Rhino Mocks (ExecutionEngineException...)

CLR

This bug has been reported to break Rhino Mocks, an open-source, mock testing framework.The specific impact to Rhino Mocks is that it breaks its support for F#, C++ and Spec# It has 71 validations and 119 ratings (avg. 4.9), which is high for a Connect bug
http://www.ayende.com/Blog/archive/2008/08/13/How-.Net-3.5-SP1-broke-Rhino-Mocks.aspx is the blog which discusses the issue with many community comments This is likely the source of much of the validations.

In 3.5 SP1 we removed a null check as a side-effect of changes we made to support ASLR. As a result, a failure case we used to handle now results in an AV in the runtime which manifests as an ExecutionEngineException and process termination

MSConnect

Serialization hangs or throws an OutOfMemoryException

CLR

This issue is also mentioned on the Rhino Mocks web site, where another breaking change in 3.5SP1 was reported. It is unclear as to whether or not this issue also breaks Rhino Mocks test software.

Due to changes in the type system, types with the following criteria:Generic type instantiated with a reference typeImplements ISerializableContains a static field.

MSConnect

AutoCommit behavior change in Oracle Transactions in .Net Framework 2.0 SP2

DPR

Existing applications which rely on transaction behavior to work correctly will break causing data corruption.

MSConnect

EntityDataSource runtime: Not able to display Dynamic Data's FK Ids in a 1:0..1 relationship

DPR

This breaks web sites/applications created with ASP.NET Dynamic Data because Dynamic Data assumes the property descriptors exist and uses them to obtain labels for their links. The only known workaround requires manually editing Dynamic Data's templates (for wich each site/app has private copies) to capture the exception. The exception generally of the form:
[HttpException (0x80004005): DataBinding: 'System.Web.UI.WebControls.EntityDataSourceWrapper' does not contain a property with the name 'Manager'.]

3rd party Forum

SaveChanges doesn't support inserting an entity and binding as a single operation

DPR

If the resource takes part in a relationship (e.g. 1:1), then while inserting a new instance of the resource, we need to send the link also, since the link is required at the database level. The client does not send the links while inserting such resources

3rd party Forum

DataServiceContext: DeleteObject on an entity with a link fails

DPR

This impacts deletion of any resource which has reference properties.

A link for a reference property should never be in Added or Deleted state. Instead, it should always be modified with reference target to null in case of delete/non-null in case of add/update.

3rd party Forum

.NET 3.5 SP1 breaks use of WPF under IIS

WPF

https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=361469

MSConnect

Relative Hyperlinks inside XPS documents broken and causes app to Crash

WPF

Fixed.

MSConnect

Regression: Geometry.Combine creates more points/segments than before in 3.5 sp1

WPF

Performance regression in scenarios with Geometry (drawn shapes).

Other

Related Posts

* Remember, if you're running around edge cases and are concerned, you can happily target 2.0 and 3.0 from VS2008 and use a CodeAnalysis Rule to make sure you're only calling methods for your targeted framework.



I hope this helps someone because it totally freaked me out this evening. I rebooted this evening, the first reboot since March, in fact, and blue-screened (BSOD) upon startup. At this point I was in a blue screen "loop" with the ominous message "INTERNAL_POWER_ERROR" on the blue screen. I started cussing Vista out and panicking, but this machine has been exceedingly stable since I built it last year and I reboot only every few months. I built it to be stable and I trust the machine.

Working backwards, the last and only interesting thing I installed was VMWare Player for Windows. I had some trepidation at the time of the install because I am not a fan of the way that VMWare adds virtual network devices that are listed in Network Connections, but it came highly recommended from respected power users I know and I needed it to install a prepared Suse VM from the Mono folks.

However, when it's installed my 64-bit machine blue screens, and it's very difficult to get uninstalled, actually. Needless to say this scared the crap out of me.

I looked all over and checked out the VMWare Forums and no one at VMWare has acknowleded the problem in a Googl-eable way. I can tell you this, however. I am using a Quad-proc machine with an MSI motherboard with the latest BIOs and a buttload of USB devices. The only way I could get the system to boot up was to remove ALL the USB devices. ALL of them, to be clear, save one wired USB Keyboard that I used to log in and remove VMWare.

My guts says that this is a bug in the VMWare USB bridging code (the stuff in VMWare that lets you use USB devices inside a VM) or it's somewhere in the USB drivers in Windows. I have the Crash Dumps if you work for VMWare and you're interested. I'll WinDBG them later this week.

I hope this post helps someone having this same issue.

UPDATE: Installed Windows Debugging Tools (WinDbg.exe) and analyzed the crash dump and it's the VMWare Keyboard Driver, of all things. Perhaps VMWare doesn't like my Wireless USB Keyboard? Mental note, relearn WinDbg'ing.

BugCheck A0, {101, 7, fffffa6001dc8b10, 0} 

*** ERROR: Module load completed but symbols could not be loaded for VMkbd.sys
Page 9bda8 not present in the dump file. Type ".hh dbgerr004" for details
Probably caused by : VMkbd.sys ( VMkbd+15da )

Followup: MachineOwner
---------

1: kd> !analyze -v
*******************************************************************************
*                        Bugcheck Analysis                                    *
*******************************************************************************

INTERNAL_POWER_ERROR (a0)
The power policy manager experienced a fatal error.
Arguments:
Arg1: 0000000000000101, Unhandled exception occured while processing a system power event.
Arg2: 0000000000000007
Arg3: fffffa6001dc8b10, ExceptionPointer.  To debug this, in the debugger type:
    'dt nt!_EXCEPTION_POINTERS <argument>'.  Then type:
    '.cxr <value of context record from the previous command>'.
    All subsequent debugger commands will show you the actual
    source of the error.  Start with a stack trace by typing 'kb'.
Arg4: 0000000000000000

Debugging Details:
------------------
Page 9bda8 not present in the dump file. Type ".hh dbgerr004" for details
BUGCHECK_STR:  0xA0
DEFAULT_BUCKET_ID:  VISTA_DRIVER_FAULT
PROCESS_NAME:  System
CURRENT_IRQL:  0
EXCEPTION_RECORD:  fffffa6001dc99a8 -- (.exr 0xfffffa6001dc99a8)
ExceptionAddress: fffff80002477af1 (nt!IofCallDriver+0x0000000000000051)
   ExceptionCode: c0000005 (Access violation)
   ExceptionFlags: 00000000
NumberParameters: 2
   Parameter[0]: 0000000000000000
   Parameter[1]: 00000000000000e0
Attempt to read from address 00000000000000e0
---------

Weird.

Technorati Tags: ,,



I have a love/hate relationship with the ASP.NET Session. It's such a convenient place to put things, but when you start putting applications into production there are a number of less-than-obvious edge cases that can come up and bite you.

Most often the Session is used when managing state over a long process like a multi-step wizard or questionnaire. However, when people use the Session, they often lean on it a little. They'll bake it into their design so deep that when it doesn't work, they're screwed. That's not to say they shouldn't be able to lean on it, I'm just saying that there's a lot of things going on with Session (not just on ASP.NET, but other frameworks as well) in order to get it to look seamless.

Built in Options

ASP.NET offers three options (four if you count rolling your own).

  • Inproc - The default, and usually works fine. However, you can get into trouble in a few scenarios.
    • Web Farms - If you have more than one web server, it's important to remember that your users may not "stick" to the same webserver with each request. Some routers offer Sticky-Sessions or the ability to "pin" a user to a server. This works well if the router uses cookies as its key, but it's less reliable if the router uses IP address/source port as the key as these may change, especially if the user is behind a mega-proxy.
    • Web Gardening - If you've setup IIS to run multiple instances of the IIS Worker Process on a single multi-proc machine, this is the equivalent of running a Web Farm, just on one machine. This technique is usually only useful when you've got a very CPU-intensive application - in other words, don't just turn on Web Gardening and expect your problems to get better instantly. It's subtle.
    • Unexpected Process Recycling - IIS6 had some wonky defaults and would recycle the AppPool or Process when some certain limits were hit, like after x number of requests or after 20 minutes. This is the classic "flaky session state is expiring" issue that lots of folks hit. You'll be more likely to see this if you've got really long running processes where users are logged in for long periods of time.
  • Out of proc - A good next step, this moves session out to a Windows Service. You can run one per Web Farm (meaning, you've got multiple machines but one instance of this service) and your session data will survive process recycles, but not system reboots. This is useful for both Web-Gardening and Web-Farming.
    • Folks usually forget to mark their objects as [Serializable] which basically gives your objects "permission" to leave their process space and be stored in memory in the State Service. If you've got a high-traffic site you might want to avoid storing complex objects and object graphs as you'll pay for it on the serialization. Of course, with all things, measure everything! You'll get best performance if you stick with basic types like strings, ints, etc.
    • UPDATE: I wanted to update this post and point folks to Maarten Balliauw's most excellent series on Out of Proc Session State (StateServer). He covers the basic setup, which is unremarkable, but then digs into the advanced stuff including "partitionResolvers" which I am ashamed to say I hadn't heard of! Recommend.
  • SQL Server - The most robust, but now you'll pay for not only serialization, but storage. However, SQL Server is a highly tuned system and if you've got a site with any significant traffic I really recommend just skipping out-of-proc and putting your session state into a SQL Server with a lot of memory. Rather than trusting ASP.NET out of proc Session State Server to be a small database, leave the database work to the databases.
    • The benefits of SQL Server for your Session State include surviving process recycles and reboots.  but more importantly using removes a lot of variables from your troubleshooting in the sense that you no longer worry about the storage of your Session, now you just need to worry if your Session Cookies are getting passed back and forth from browser to server.
    • Make sure you're using Windows Integrated Security and that you decide if you want ASP.NET to store Session in tempdb (which won't survive a SQL recycle) or a dedicated database (my recommendation).

Troubleshooting

There's a number of things that can go wrong, some of which I mention above, but here's what I usually run through when troubleshooting things.

  • Is the ASP.NET SessionID Cookie actually moving back and forth between browser and server. This can be confirmed by:
    • Using an HTTP Sniffer like ieHttpHeaders or HttpWatch or Fiddler and confirming that the Session ID cookie's value isn't changing between requests.
    • Confirming that the cookie isn't being blocked by IE, privacy settings, lack of a P3P policy document, local firewall like ZoneAlarm or Symantec, or a corporate proxy with an attitude problem.
  • Is IIS recycling  the AppPool or Worker Process? Confirm the settings in IIS manager and make sure they are right for what you're doing.
  • Is the session timing out? Are you sure you're hitting the same VDir from whence you came and successfully resetting the sliding expiration on the Session ID?
  • Is some other thing like an Ajax call or IE's Content Advisor simultaneously hitting the default page or login page and causing a race condition that calls Session.Abandon? (It's happened before!)

At my last company Session became such a hassle for large high traffic applications that we just stopped using in-proc and started exploring alternatives.

Some 3rd Party Session State Options

  • NCache from Alachisoft - An in-memory object cache that's distributed across your web farm. Think of it like Out of Process Session State, but distributed/clustered in their Enterprise Edition.
  • ScaleOut Software SessionServer - Fast, scalable in-memory storage that is distributed across machines. Full Disclosure: we worked with these guys while I was at Corillian, but never put them into production.
  • Memcached Session State Provider - Fahad has created ASP.NET Session State providers that will talk to memcached, a very popular distributed memory caching system originally created for LiveJournal.com and now used all over.

Related Links you might enjoy

How do you manage state at your company?



The Mystery of the Failed Live Meeting Launch

Posted 2007-09-19 03:14 AM in Bugs | Musings | Tools.

I've got to attend my first Microsoft Live Meeting in the morning, and since I'm remote I thought I'd just run the quick test of the Live Meeting Client before bed. You know, you visit a test page with your browser, and a Live Meeting client "jumps out" of the browser and connects. I've done it a million times before.

I open the Calendar Meeting, click, and...I get a dialog titled:

"RTC Router" - "The directory name is invalid"

Of course, I try it at least 10 times to make sure it's REALLY not working. You never know, it could work that 9th try, right?

OK. Now I'm getting tense. I need this to work, the LiveMeeting is in the morning. Um, reinstall, ok...just reinstall.

Microsoft has an internal website that you download all the corporate IT products you need for your regular job. I go back up in IE, am prompted for my Microsoft domain account and password (this machine isn't on the domain), find the right page, download the MSI and run the installation in place. OK. Whew. I go back open the Calendar Meeting, click, and...I still get a dialog titled:

"RTC Router" - "The directory name is invalid"

Crap. Ok, it's Procmon time. Who owns this dialog box? I give the dialog a good shake while Task Manager is open. That's a low-tech way of answering the Who's Process Is This question - grab a dialog with the mouse and shake it around the screen...the process that owns it will start using a little bit of CPU.

It's RunDll32.exe. That's a generic process that runs Procedures directly within DLLs. Basically a LoadLibrary()|GetProcAddress() command-line interface.

Now, I set the filters in Procmon to just watch two processes - iexplore.exe and rundll32.exe. I then reproduce the issue and watch the logs.

RunDll32

OK, looks like this is being called when I click the link in IE:

C:\Windows\system32\rundll32.exe "C:\Program Files (x86)\Common Files\Microsoft Shared\LiveMeeting Shared\RtcRouter.dll",RouteMIME %1

It's being launched because of the mime/type of the file being returned from the web server. The registry says that there's a .rtc and .rtc-ms extension of type "Microsoft.RTC.ConnectionFile."

Registry Editor

The Set Associations Dialog in Vista confirms it.

Set Associations

So, this RunDll32 RtcRouter.dll action is the "Microsoft Office Live Meeting Router." RTC is probably Real Time Communication, but at this point I don't care.

Now, I reproduce the failure again and look for the "Live Meeting" string.

MoreRegistry

This run shows three things that are important. First the very top shows the writing to a log file called pwconsole-debug30.txt...it contains just this:

[MC] 08:55:50:031 GMT [PID 9228] [THREAD 4996]  [I] RTCRouter - RouteMIME called
[MC] 08:55:50:033 GMT [PID 9228] [THREAD 4996]  [W] RTCRouter - Inserting for HKLM - {69CEBEF8-52AA-4436-A3C9-684AF57B0307}
[MC] 08:55:50:042 GMT [PID 9228] [THREAD 4996]  [W] RTCRouter - Using Target Product code : {69CEBEF8-52AA-4436-A3C9-684AF57B0307}
[MC] 08:55:50:043 GMT [PID 9228] [THREAD 4996]  [E] RTCRouter - Error launching console

Ah, but the second thing in Procmon that jives with this long is the GUID which is apparently a Microsoft Installer Product Code leading to a Component which is the LiveMeeting Console.

Notice the Access Denied in reading the PWConsole.exe. Ok, so this is a permissions issue.

I head down into C:\Program Files (x86)\Microsoft Office\Live Meeting 8 and get ACCESS DENIED! What? I can't even go into my own folder? I JUST made this folder when I ran that installer.

Hm. OK, I'm Administrator, so I'm taking over ownership. I open an Administrator cmd.exe and from within that folder, run:

takeown /f "Live Meeting 8" /r /a
SUCCESS: The file (or folder) is now owned by user QUADPOWER\scott

That'll teach you. Now, I took ownership, but I still need permissions, so I go into Properties, Security, and I'm sure to go into Advanced|Edit|Edit and select "Replace all existing permissions" as I want to make sure I'm taking control of the entire directory and all files, not just one directory and forgetting to recurse.

Console

NOTE:  I'm just reporting my experience here, be careful when you do crazy stuff as Administrator and don't come to me when it all blows up for you. YMMV. Seriously.

I immediately notice something I didn't see before...the PWConsole NOW has an icon. I had a generic one before. AH. I've got permissions. And by I, I mean, explorer.exe.

Console (4)

Cool, now I go back into Outlook, click on the Live Meeting Test Link, and I'm in:

Microsoft Office Live Meeting - livemeeting.com - Live Meeting 2007 Console Test

Conclusion

How did I get myself into this situation? Here's my working theory.

  1. When I’m remoted into Corporate authenticated as, say, MICROSOFT\mrscott on my home computer that
    1. doesn’t have a machine account
    2. and where MICROSOFT\mrscott is a temporary identity (it’s not admin, and it’s just hanging out launching some processes, and not others) and
    3. I run installations with that domain authenticated identity via direct launching from Internet Explorer
  2. THEN:
    1. those installations run as MICROSOFT\mrscott the whole time and regular LOCALMACHINE\scott can’t access them, resulting in chaos and confusion, directories and files created and owned by an account that isn't on this machine. Oh, and it results in blog posts like this.

Is this something others might be having trouble with and who should be told?  Or, is this totally obvious and easily discoverable?

Of course! Just don’t run MSI installers launched directly from a Intranet website when you're domain authenticated against that site as someone who doesn't have administrator privileges on the local machine. <sarcasm>It's so obvious!</sarcasm> Well, actually, stated like that, it does make sense. I can't add my domain account as an Administrator on this machine without joining the box to the domain, which I don't want to do. So, I'll download my installers from the internal sites and then run them from now on.

Good night!



Page 1 of 34 in the Bugs category Next Page

Contact

Sponsors

Hosting By

Hot Topics

Tags

Calendar

<November 2009>
SunMonTueWedThuFriSat
25262728293031
1234567
891011121314
15161718192021
22232425262728
293012345

Archives

November, 2009 (5)
October, 2009 (19)
September, 2009 (11)
August, 2009 (12)
July, 2009 (21)
June, 2009 (26)
May, 2009 (16)
April, 2009 (13)
March, 2009 (17)
February, 2009 (17)
January, 2009 (18)
December, 2008 (32)
November, 2008 (17)
October, 2008 (22)
September, 2008 (16)
August, 2008 (14)
July, 2008 (25)
June, 2008 (19)
May, 2008 (17)
April, 2008 (17)
March, 2008 (26)
February, 2008 (21)
January, 2008 (28)
December, 2007 (19)
November, 2007 (17)
October, 2007 (31)
September, 2007 (39)
August, 2007 (37)
July, 2007 (43)
June, 2007 (37)
May, 2007 (32)
April, 2007 (38)
March, 2007 (29)
February, 2007 (46)
January, 2007 (31)
December, 2006 (27)
November, 2006 (31)
October, 2006 (32)
September, 2006 (39)
August, 2006 (34)
July, 2006 (40)
June, 2006 (18)
May, 2006 (31)
April, 2006 (34)
March, 2006 (30)
February, 2006 (38)
January, 2006 (44)
December, 2005 (19)
November, 2005 (34)
October, 2005 (24)
September, 2005 (37)
August, 2005 (20)
July, 2005 (24)
June, 2005 (33)
May, 2005 (16)
April, 2005 (22)
March, 2005 (34)
February, 2005 (15)
January, 2005 (37)
December, 2004 (28)
November, 2004 (30)
October, 2004 (34)
September, 2004 (22)
August, 2004 (34)
July, 2004 (18)
June, 2004 (64)
May, 2004 (49)
April, 2004 (21)
March, 2004 (29)
February, 2004 (29)
January, 2004 (36)
December, 2003 (25)
November, 2003 (24)
October, 2003 (59)
September, 2003 (42)
August, 2003 (24)
July, 2003 (44)
June, 2003 (29)
May, 2003 (21)
April, 2003 (30)
March, 2003 (27)
February, 2003 (47)
January, 2003 (50)
December, 2002 (31)
November, 2002 (38)
October, 2002 (44)
September, 2002 (15)
May, 2002 (2)
April, 2002 (4)

Google Ads