Service and COM don't work with Windows XP Service Pack 2

I have a service application created with VB.NET that creates a COM object.

The service works fine in Windows 2000, but in Windows XP with service pack 2 it doesn't  because it receives the "Access denied" error.

If I create a windows form application instead of a service, it works fine even in Windows XP with service pack 2. 

Can someone help me

 




Answer this question

Service and COM don't work with Windows XP Service Pack 2

  • milesrush

    I created a separated test service to run under NETWORK SERVICE.

    The error is the same (Class not registered).

     



  • yayah_1

    Hi Michael,

    My service is running in the context of the Administrator and the problem happens when it executes the code above:

    Dim opcsrv As OPCServerClass ' 'This is a third party COM class developed in C++

    opcsrv = New OPCServerClass

    opcsrv.Connect("RSLinx OPC Server") 'The error is thrown here

    The error message is: "Class not registered".

    But note that the error only happens for service application running in Windows XP, that is, if I put the same instructions in a Windows Form running in Windows XP it works ok.

     

     

     

     

     



  • Peter V

    If you reconfigure your service to run using NetworkService does it resolve the problem   The administrator account you are running under, is it a local admin or a domain admin

    Michael Taylor - 12/23/05


  • WilliamDGJones

    Hi Michael,

    I have made tests and I discovered that runnig my service under SYSTEM it works.

    But I want to run under Administrator.

    Do you have some idea

    Happy New Year.

     



  • Nick Lenting

    What I'm trying to piece together is why you are getting the class not registered error from within the service and not from outside of the service.  The biggest difference between the two is the account they run under.  I'm not guaranteeing that it'll solve your problem but getting the service to run under NETWORK SERVICE may provide more answers.  You can create a separate test service or you could modify your SQL connection string to temporarily hard-code the normal administrator user.  Whichever is easiest for you.

    Michael Taylor - 12/23/05


  • Pops Jackson

    Run dcomcfg.msc and check the security settings (Launch and Access permissions)  of this out-proc server (under DCOM Config). By default only SYSTEM and SELF are granted access permissions, you should add Administrator.

    Willy.

     

     


  • Eric2002

    You are experiencing a security issue because your service is running in the context of the SYSTEM account (probably) and not a normal user.  Windows XP is far more secure than W2K so the problem could be anywhere.  A user might not even be logged in so you can't even rely on that.  Note also that you can't display a UI from within your service (technically you can but it is pretty advanced).

    You need to identify where your service accesses resources such as registry entries or the file system.  This will help to narrow down the problem.  You can use tools like FileMon and RegMon (www.sysinternals.com) to determine where the access denied is coming from if it is file or registry-based but it is probably just easier to debug your code.  You'll need to read in the online help on how to debug a service because it is different than a normal app.  You should also add some diagnostics code to your app to determine where the error is occurring.

    Michael Taylor - 12/22/05


  • Sumit8888

    My service also connects to the MSSQL so I can't change the Administrator account.

    Don't you think that Administrator is enough

    If you think that NETWORKSERVICE could resolve, I'll create another project only for test.

     



  • Scott Ritter

    I thought you were getting an access denied error   Class not registered is a different beast entirely.  Is your service set to autostart   If so did you try starting it manually to see if it works   Is your COM server inproc or out-of-proc  

    Michael Taylor - 12/23/05


  • Siddharth Fadnis

    Excuse me, but I don't know how to reconfigure my service to use NetworkService. Can you give me more information

    The administrator account is local (workgroup not a domain).



  • programmer2005

    Just a quick question if you are getting an access denied error when trying to access the service form the Client Application in order to quickly fix the problem go to the properties window of the Service and Security tab disable security "Enforce access checks for this application.
  • jketola

    My service is running in the context of the Administrator and the problem happens when it executes the code above:

    Dim opcsrv As OPCServerClass ' 'This is a third party COM class developed in C++

    opcsrv = New OPCServerClass

    opcsrv.Connect("RSLinx OPC Server") 'The error is thrown here

    The error message is: "Class not registered".

    But note that the error only happens for service application running in Windows XP, that is, if I put the same instructions in a Windows Form running in Windows XP it works ok.

    The same service and COM work ok if they run in W2K or NT.

     



  • Patrick Cournoyer

    Excuse me by the wrong error message, in fact, the massage is "Class not registered".

    I already tried starting automatic and manually but the problem is the same.

    The COM is out-of-proc.



  • arc_dev

    Go to Administrative Tools\Services (accessible through Control Panel).  Find your service in the list of services.  Double-click the service name to open the properties.  Go to the Log On tab.  What is the service currently set to run as

    Select the This account option and enter NETWORK SERVICE.  Clear the values from the Password and Confirm Password boxes and click OK.  Stop and restart your service.

    Michael Taylor - 12/23/05


  • Service and COM don't work with Windows XP Service Pack 2