Saar Carmi

A .NET Blog

<November 2008>
SuMoTuWeThFrSa
2627282930311
2345678
9101112131415
16171819202122
23242526272829
30123456


Navigation

Subscriptions

Post Categories



Wednesday, August 18, 2004 - Posts

Services without Components works on XP without SP2

Alex Thissen wrote about Services without Components works on XP without SP2

Well, I just saw his post (after the WinXP SP2 is available for MSDN subscribers).

Microsoft does not support SWC on WinXP but we were able to use it anyway:

1. Add reference to COMSVCLib

2. To enter a transaction use this code:

IServiceTransactionConfig cfg = (IServiceTransactionConfig) new CServiceConfigClass();

cfg.ConfigureTransaction (tagCSC_TransactionConfig.CSC_CSC_CreateTransactionIfNecessary);

DTCAPI.CoEnterServiceDomain(cfg);

3. To leave the transaction use this code:

DTCAPI.MyTxStatus stat = new DTCAPI.MyTxStatus();

DTCAPI.CoLeaveServiceDomain(stat);

4. Before your leave the transaction call ContextUtil.SetAbort() or ContextUtil.SetComplete().

Our developers have Win XP operating system and our product run on Win 2003. As we wanted to write code that uses SWC, we have wrapped System.EnterpriseServices.ServiceConfig and the code above (in two classes with base class)

We have a Win2003ServiceConfig and a WinXPServiceConfig. A ServiceConfig factory chooses the right class according to the operating system.

For that last 6 months we have used SWC on XP and it works.

For some reasons after installing the Microsoft's 828741 HotFix for WinXP this solution didnt work. We didnt check why because we decided to wait for SP2 to what happens - it should be supported by the .Net framework just like under Win2003.

Interesting information about why SWC with the .Net framework didnt work with WinXP

http://www.winterdom.com/weblog/archives/000227.html

 

posted Wednesday, August 18, 2004 4:26 AM by saarc with 1 Comments




Powered by Dot Net Junkies, by Telligent Systems