Windows Service with MSCommLib

I have created a windows service in VB.Net that uses the MSCommLib namespace. I then instantiate as per below

MyComm = New MSCommLib.MSComm
       
        MyComm.CommPort = 4
        MyComm.DTREnable = True
        MyComm.EOFEnable = False
        MyComm.Handshaking = HandshakeConstants.comNone
        MyComm.InBufferSize = 1024
        MyComm.InputLen = 0
        MyComm.InputMode = InputModeConstants.comInputModeText
        MyComm.OutBufferSize = 512
        MyComm.ParityReplace = "?"
        MyComm.RThreshold = 0
        MyComm.RTSEnable = False
        MyComm.SThreshold = 0
        MyComm.Settings = "9600,n,8,1"

        MyComm.PortOpen = True


I have successfully installed and start the service on my laptop but when I install it on another server that is running either Windows Server 2003 or Windows Small Business Server 2011, I get this error when trying to start the service.

Application: MyDAService.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.Runtime.InteropServices.COMException
Stack:
   at System.RuntimeTypeHandle.CreateInstance(System.RuntimeType, Boolean, Boolean, Boolean ByRef, System.RuntimeMethodHandleInternal ByRef, Boolean ByRef)
   at System.RuntimeType.CreateInstanceSlow(Boolean, Boolean, Boolean)
   at System.RuntimeType.CreateInstanceDefaultCtor(Boolean, Boolean, Boolean, Boolean)
   at System.Activator.CreateInstance(System.Type, Boolean)
   at MyDAService.Service1..ctor()
   at MyDAService.Service1.Main()
keymacAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Randy DownsOWNERCommented:
Maybe this will help.

try breaking when the exception is thrown. Go to Debug > Exceptions... and use the Find... option to locate System.Runtime.InteropServices.COMException. Tick the option to break when it's thrown and then debug your application.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Gautham JanardhanCommented:
I assume tht these com objects are available in the server?

Does the user behalf of whom the service is running have access to create the com object?
0
keymacAuthor Commented:
How do I confirm that the server has the objects available
0
Bob LearnedCommented:
If you need to use the serial port, there is a completed managed version that doesn't use COM, and is part of the .NET framework.

System.IO.SerialPort

Communication on a serial port in NET 2.0
http://www.codeproject.com/Articles/17190/Communication-on-a-serial-port-in-NET
0
Seth SimmonsSr. Systems AdministratorCommented:
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows Server 2003

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.