Tuesday, January 17, 2006

Simulate Windows Service using ASP.NET to run scheduled jobs - The Code Project - ASP.NET

Simulate Windows Service using ASP.NET to run scheduled jobs - The Code Project - ASP.NET: "How to run scheduled jobs from ASP.NET without requiring a Windows Service to be installed on the server? Very often we need to run some maintenance tasks or scheduled tasks like sending reminder emails to users from our websites. This can only be achieved using a windows service. ASP.NET being stateless provides no support to run some code continuously or to run code at scheduled time. As a result, we have to make our own Windows Services in order to run scheduled jobs or cron jobs. But in a shared hosted environment, we do not always have the luxury to deploy our own windows service to our hosting provider's web server. We either have to buy a dedicated server which is very costly, or sacrifice such features in our web solution. However, running scheduled task is a very handy feature especially for sending reminder emails to users, maintenance reports to administrator, run cleanup operations etc. So, I will show you a tricky way to run scheduled jobs using pure ASP.NET without requiring any windows service. This solution runs on any hosting service providing just ASP.NET hosting. As a result, you can have scheduled job feature in your ASP.NET web projects without buying dedicated servers. "

SafeCOMWrapper - Managed Disposable Strongly Typed safe wrapper to late bound COM - The Code Project - C# Programming

SafeCOMWrapper - Managed Disposable Strongly Typed safe wrapper to late bound COM - The Code Project - C# Programming: "There are several problems using COM from .NET:
You cannot implement the Dispose pattern by utilizing the 'using' block in order to safely dispose COM references.
You cannot guaranty COM references are finalized. There's no way to implement '~Destructor()' for COM references.
COM reference is not released when a call to Marshal.ReleaseComObject is skipped due to an Exception.
When you 'Add Reference...' to a COM library, the reference is version specific. So, if you add a reference to the Office 2003 COM library, it does not work properly when deployed to Office 2000.
The only solution to version independent COM is to use Late Bound operations but you miss all the features of a strongly typed language.
Let's solve all these problems. We want to use a Managed strongly typed approach to Late Bound COM operations and also utilize the Dispose pattern on COM objects. The solution proposed here works for any COM object which can be Microsoft Office COM libraries, IE & DHTML objects and even your own COM objects. You should use this approach whenever you are dealing with any type of COM library.
Before going to the solution, let's learn a bit of background on RealProxy and method interception."