Freigeben über


Detecting ASP.NET Compatibility

How can I find out whether my service is running in ASP.NET compatibility mode?

Why do you need to detect at runtime whether you're running in compatibility mode? As I've said before, compatibility mode is something that the odd and rare service takes advantage of to get one of the few features that are not available in the standard pipeline. If you care about compatibility mode, then it's very likely that your service will simply not work without it. That's one of the reasons for decorating your service with the AspNetCompatibilityRequirements attribute. It frequently makes sense to prohibit compatibility mode and it sometimes makes sense to require compatibility mode, but it almost never makes sense to optionally allow compatibility mode. This decision should be very intentional.

If you do need to check for compatibility mode at runtime though, then you can use the AspNetCompatibilityEnabled property of ServiceHostingEnvironment.

Next time: Custom Transport Retry Logic

Comments

  • Anonymous
    November 02, 2007
    I have a one-way operation that processes requests and can sometimes fail. When the operation fails,