473,689 Members | 3,048 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

.NET Windows Service produces Exception errors?

I have created a Windows service which performs various functions
including setting variables in other application objects.

When the service runs under Local System account the functionality all
works OK, however when service runs under a user account it produces
exception errors when trying to set variables in the application
objects.

I created a .exe test harness which does the same and works OK when
run by the same user.

Anybody have any ideas on:
What is the difference when compiled as service compared to
application?
Why this works with service running under LocalSystem account and not
user account?
How can I get this to work with a user account?
Regards
Richard Marder
Nov 21 '05 #1
3 3893
Richard,
Without knowing specifically what "other application objects" you are using
and what exceptions you are receiving, its hard to say how to get it to
work.

Can you provided a complete yet short example of what you are attempting (10
to 20 lines of actual code) along with the exception you are receiving?

Hope this helps
Jay

"Richard" <ma*****@logica .com> wrote in message
news:4d******** *************** ***@posting.goo gle.com...
I have created a Windows service which performs various functions
including setting variables in other application objects.

When the service runs under Local System account the functionality all
works OK, however when service runs under a user account it produces
exception errors when trying to set variables in the application
objects.

I created a .exe test harness which does the same and works OK when
run by the same user.

Anybody have any ideas on:
What is the difference when compiled as service compared to
application?
Why this works with service running under LocalSystem account and not
user account?
How can I get this to work with a user account?
Regards
Richard Marder

Nov 21 '05 #2
Jay,

I am replying on behalf of Richard.

On our a Windows 2000 Production database server, a .NET Windows Service
called the PDCProcessor is unable to communicate with MapObjects COM
code to spatially register a point.

The box has the .NET Framework 1.0 and SDK installed and uses MapObjects
2.3.

Any ideas would be great!

1. This exception is thrown when we attempt to connect to the spatial
database to spatially register a point.

Event Type: Error
Event Source: PDCProcessor
Event Category: None
Event ID: 1
Date: 09/11/2004
Time: 16:08:06
User: N/A
Computer: RIMVDBS02
Description:
The description for Event ID ( 1 ) in Source ( PDCProcessor ) cannot be
found. The local computer may not have the necessary registry
information or message DLL files to display messages from a remote
computer. The following information is part of the event: 2004-11-09
16:08:06,817 [5308] FATAL Logica.RIMNET3. DAL.clsSpatialC onnection -
SystemException Exception Type = System.InvalidC astException
Exception Message = QueryInterface for interface
ESRI.MapObjects 2.Core.IMoDataC onnection failed.
Exception Stack = at System.RuntimeT ype.InvokeDispM ethod(String name,
BindingFlags invokeAttr, Object target, Object[] args, Boolean[]
byrefModifiers, Int32 culture, String[] namedParameters )
at System.RuntimeT ype.InvokeMembe r(String name, BindingFlags
invokeAttr, Binder binder, Object target, Object[] args,
ParameterModifi er[] modifiers, CultureInfo culture, String[]
namedParameters )
at System.RuntimeT ype.ForwardCall ToInvokeMember( String memberName,
BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData&
msgData)
at ESRI.MapObjects 2.Core.DataConn ectionClass.set _Server(String A_1)
at Logica.RIMNET3. DAL.clsSpatialC onnection.conne ctSDE(Boolean
boolRefDB)
..
2. This exception is thrown when we attempt to convert a grid reference
to an easting-northing.

Event Type: Error
Event Source: PDCProcessor
Event Category: None
Event ID: 0
Date: 09/11/2004
Time: 16:09:41
User: N/A
Computer: RIMVDBS02
Description:
The description for Event ID ( 0 ) in Source ( PDCProcessor ) cannot be
found. The local computer may not have the necessary registry
information or message DLL files to display messages from a remote
computer. The following information is part of the event: 2004-11-09
16:09:41,055 [3940] ERROR Logica.RIMNET3. GAD.clsPointCon version -
Exception: System.InvalidC astException
Message: QueryInterface for interface ESRI.MapObjects 2.Core.IMoPoint
failed.
Source: mscorlib
at System.RuntimeT ype.InvokeDispM ethod(String name, BindingFlags
invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers,
Int32 culture, String[] namedParameters )
at System.RuntimeT ype.InvokeMembe r(String name, BindingFlags
invokeAttr, Binder binder, Object target, Object[] args,
ParameterModifi er[] modifiers, CultureInfo culture, String[]
namedParameters )
at System.RuntimeT ype.ForwardCall ToInvokeMember( String memberName,
BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData&
msgData)
at ESRI.MapObjects 2.Core.PointCla ss.set_X(Double A_1)
at
Logica.RIMNET3. GAD.clsPointCon version.gridRef ToEastingNorthi ng(String
strGridRef, enmProjectionTy pes& i32Projection)

..

3. The code that generates the second exception is:

Imports ESRI.MapObjects 2.Core
Imports Logica.RIMNET3. DataAccess.Fram ework
Imports Logica.RIMNET3. DataAccess.SqlS erver
Imports Logica.RIMNET3. common

Public Function gridRefToEastin gNorthing(ByVal strGridRef As String,
ByRef i32Projection As enmProjectionTy pes) As Point
'-----------------------------------------------------------------------
---
' Declarations

'-----------------------------------------------------------------------
---
Dim objPoint As Point
'-----------------------------------------------------------------------
---
' Database Declarations

'-----------------------------------------------------------------------
---
Dim objRequest As New DARequest()
Dim objFactory As DAFactory
Dim i32Easting As Int32
Dim i32Northing As Int32

Try

'-----------------------------------------------------------------------
---
' Setup the stored procedure

'-----------------------------------------------------------------------
---
objFactory = New SqlDataAccessHe lper(m_i32Opera tingMode)
objRequest.Comm and =
m_strSP_CONVERT _GRID_REF_TO_EA ST_NORTH
'-----------------------------------------------------------------------
---
' Setup the parameters

'-----------------------------------------------------------------------
---
objRequest.Popu lateParams(m_st rARG_GRID_REF, strGridRef,
False)
objRequest.Popu lateParams(m_st rARG_REGION_COD E, "",
True)
objRequest.Popu lateParams(m_st rARG_EASTING, i32Easting,
True)
objRequest.Popu lateParams(m_st rARG_NORTHING,
i32Northing, True)
'-----------------------------------------------------------------------
---
' Get the converted NGR value

'-----------------------------------------------------------------------
---
objFactory.Exec uteNonQuery(obj Request)

If Not objRequest.GetP aramValue(m_str ARG_REGION_CODE ) Is
System.DBNull.V alue _
AndAlso Not
objRequest.GetP aramValue(m_str ARG_EASTING) Is System.DBNull.V alue _
AndAlso Not
objRequest.GetP aramValue(m_str ARG_NORTHING) Is System.DBNull.V alue Then

Select Case
CStr(objRequest .GetParamValue( m_strARG_REGION _CODE))
Case m_strGRID_CODE_ GB
i32Projection =
enmProjectionTy pes.BritishNati onalGrid
Case m_strGRID_CODE_ IE
i32Projection =
enmProjectionTy pes.IrishNation alGrid
Case m_strGRID_CODE_ CI
i32Projection =
enmProjectionTy pes.ChannelIsla nds
End Select

objPoint = New Point()
objPoint.X =
CDbl(objRequest .GetParamValue( m_strARG_EASTIN G))
objPoint.Y =
CDbl(objRequest .GetParamValue( m_strARG_NORTHI NG))

End If

Catch objDAExcp As DAException
If m_objLog.IsErro rEnabled Then
m_objLog.Error( objDAExcp)

Catch objExcp As Exception
If m_objLog.IsErro rEnabled Then m_objLog.Error( objExcp)

End Try
'-----------------------------------------------------------------------
---
' Return from the function

'-----------------------------------------------------------------------
---
If IsNothing(i32Pr ojection) Or IsNothing(objPo int) Then
Throw New EastNorthNotObt ainedException( )
Else
Return objPoint
End If

End Function

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 21 '05 #3
Simon,
Sorry for the delay, holidays & what ever...

Are you certain that the MapObjects on your server is the same level as on
your development box?

The System.InvalidC astException would suggest that you may be looking for a
newer COM object (newer GUID) or a COM object that simply is not supported
in the version on your server.
Can you run the service, as a service, on the development box. Does it work?
It may be an authority thing with how services run.

Hope this helps
Jay


"Simon Berman" <si**********@l ogicacmg.com> wrote in message
news:OV******** ******@TK2MSFTN GP10.phx.gbl...
Jay,

I am replying on behalf of Richard.

On our a Windows 2000 Production database server, a .NET Windows Service
called the PDCProcessor is unable to communicate with MapObjects COM
code to spatially register a point.

The box has the .NET Framework 1.0 and SDK installed and uses MapObjects
2.3.

Any ideas would be great!

1. This exception is thrown when we attempt to connect to the spatial
database to spatially register a point.

Event Type: Error
Event Source: PDCProcessor
Event Category: None
Event ID: 1
Date: 09/11/2004
Time: 16:08:06
User: N/A
Computer: RIMVDBS02
Description:
The description for Event ID ( 1 ) in Source ( PDCProcessor ) cannot be
found. The local computer may not have the necessary registry
information or message DLL files to display messages from a remote
computer. The following information is part of the event: 2004-11-09
16:08:06,817 [5308] FATAL Logica.RIMNET3. DAL.clsSpatialC onnection -
SystemException Exception Type = System.InvalidC astException
Exception Message = QueryInterface for interface
ESRI.MapObjects 2.Core.IMoDataC onnection failed.
Exception Stack = at System.RuntimeT ype.InvokeDispM ethod(String name,
BindingFlags invokeAttr, Object target, Object[] args, Boolean[]
byrefModifiers, Int32 culture, String[] namedParameters )
at System.RuntimeT ype.InvokeMembe r(String name, BindingFlags
invokeAttr, Binder binder, Object target, Object[] args,
ParameterModifi er[] modifiers, CultureInfo culture, String[]
namedParameters )
at System.RuntimeT ype.ForwardCall ToInvokeMember( String memberName,
BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData&
msgData)
at ESRI.MapObjects 2.Core.DataConn ectionClass.set _Server(String A_1)
at Logica.RIMNET3. DAL.clsSpatialC onnection.conne ctSDE(Boolean
boolRefDB)
.
2. This exception is thrown when we attempt to convert a grid reference
to an easting-northing.

Event Type: Error
Event Source: PDCProcessor
Event Category: None
Event ID: 0
Date: 09/11/2004
Time: 16:09:41
User: N/A
Computer: RIMVDBS02
Description:
The description for Event ID ( 0 ) in Source ( PDCProcessor ) cannot be
found. The local computer may not have the necessary registry
information or message DLL files to display messages from a remote
computer. The following information is part of the event: 2004-11-09
16:09:41,055 [3940] ERROR Logica.RIMNET3. GAD.clsPointCon version -
Exception: System.InvalidC astException
Message: QueryInterface for interface ESRI.MapObjects 2.Core.IMoPoint
failed.
Source: mscorlib
at System.RuntimeT ype.InvokeDispM ethod(String name, BindingFlags
invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers,
Int32 culture, String[] namedParameters )
at System.RuntimeT ype.InvokeMembe r(String name, BindingFlags
invokeAttr, Binder binder, Object target, Object[] args,
ParameterModifi er[] modifiers, CultureInfo culture, String[]
namedParameters )
at System.RuntimeT ype.ForwardCall ToInvokeMember( String memberName,
BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData&
msgData)
at ESRI.MapObjects 2.Core.PointCla ss.set_X(Double A_1)
at
Logica.RIMNET3. GAD.clsPointCon version.gridRef ToEastingNorthi ng(String
strGridRef, enmProjectionTy pes& i32Projection)

.

3. The code that generates the second exception is:

Imports ESRI.MapObjects 2.Core
Imports Logica.RIMNET3. DataAccess.Fram ework
Imports Logica.RIMNET3. DataAccess.SqlS erver
Imports Logica.RIMNET3. common

Public Function gridRefToEastin gNorthing(ByVal strGridRef As String,
ByRef i32Projection As enmProjectionTy pes) As Point
'-----------------------------------------------------------------------
---
' Declarations

'-----------------------------------------------------------------------
---
Dim objPoint As Point
'-----------------------------------------------------------------------
---
' Database Declarations

'-----------------------------------------------------------------------
---
Dim objRequest As New DARequest()
Dim objFactory As DAFactory
Dim i32Easting As Int32
Dim i32Northing As Int32

Try

'-----------------------------------------------------------------------
---
' Setup the stored procedure

'-----------------------------------------------------------------------
---
objFactory = New SqlDataAccessHe lper(m_i32Opera tingMode)
objRequest.Comm and =
m_strSP_CONVERT _GRID_REF_TO_EA ST_NORTH
'-----------------------------------------------------------------------
---
' Setup the parameters

'-----------------------------------------------------------------------
---
objRequest.Popu lateParams(m_st rARG_GRID_REF, strGridRef,
False)
objRequest.Popu lateParams(m_st rARG_REGION_COD E, "",
True)
objRequest.Popu lateParams(m_st rARG_EASTING, i32Easting,
True)
objRequest.Popu lateParams(m_st rARG_NORTHING,
i32Northing, True)
'-----------------------------------------------------------------------
---
' Get the converted NGR value

'-----------------------------------------------------------------------
---
objFactory.Exec uteNonQuery(obj Request)

If Not objRequest.GetP aramValue(m_str ARG_REGION_CODE ) Is
System.DBNull.V alue _
AndAlso Not
objRequest.GetP aramValue(m_str ARG_EASTING) Is System.DBNull.V alue _
AndAlso Not
objRequest.GetP aramValue(m_str ARG_NORTHING) Is System.DBNull.V alue Then

Select Case
CStr(objRequest .GetParamValue( m_strARG_REGION _CODE))
Case m_strGRID_CODE_ GB
i32Projection =
enmProjectionTy pes.BritishNati onalGrid
Case m_strGRID_CODE_ IE
i32Projection =
enmProjectionTy pes.IrishNation alGrid
Case m_strGRID_CODE_ CI
i32Projection =
enmProjectionTy pes.ChannelIsla nds
End Select

objPoint = New Point()
objPoint.X =
CDbl(objRequest .GetParamValue( m_strARG_EASTIN G))
objPoint.Y =
CDbl(objRequest .GetParamValue( m_strARG_NORTHI NG))

End If

Catch objDAExcp As DAException
If m_objLog.IsErro rEnabled Then
m_objLog.Error( objDAExcp)

Catch objExcp As Exception
If m_objLog.IsErro rEnabled Then m_objLog.Error( objExcp)

End Try
'-----------------------------------------------------------------------
---
' Return from the function

'-----------------------------------------------------------------------
---
If IsNothing(i32Pr ojection) Or IsNothing(objPo int) Then
Throw New EastNorthNotObt ainedException( )
Else
Return objPoint
End If

End Function

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
507
by: MatthewRoberts | last post by:
Howdy All, I have a Windows Service that often stops in its tracks with no exception and no explanation on our QA system. During testing on the development machine, it can handle any workload, and complete with no problems. Even during testing on another test machine, it can handle any workload, and complete with no problems. This behavior has been tested multiple times.
12
2764
by: JSheble | last post by:
I've written a Windows Service using C#, but I cannot seem to figure out how to cancel or prevent the service from starting under certain conditions. For example, in the OnStart I read in some configuration settings, and if anything is either empty, or invalid (such as a DB DataSource string or a missing diredtory, etccc) I don't want the servie to start. So how would I cancel the start up?
6
2170
by: Nathan Kovac | last post by:
Yesterday afternoon I was getting the following errors in a windows service: 'DatabaseManager.DataComponent', 'Error', '3 Errors: Line: 0 - Metadata file 'ScriptingMethods.dll' could not be found Line: 0 - Metadata file 'RemoteLoader.dll' could not be found Line: 0 - Metadata file 'wwScripting.dll' could not be found' Service ran all night fine. This morning I reconnected to the process and the errors are no longer there. Only thing...
3
4554
by: Gerard | last post by:
Hello I have created a windows service to monitor a database, it starts some checks when a timer elapses. The checks send emails depending on their findings. My issue is that when I created a windows application it worked fine, however I need to use a service as I don't want to rely on a user being logged in. The errors I get are: Index #:System.Web.HttpException: Could not access 'CDO.Message' object. --->...
7
7941
by: Larry Bird | last post by:
I have a windows service that want to un-install. When I run "installutil /u serivcename" I get the error that the serivce is not installed on my machine. However, when view the serivce console I still see my service there. What must be done to remove a windows service written in VB.Net from my system. I'm trying un-install the service because I'm compiling it as a console application to perform debugging. I think it will be easier to...
4
5612
by: Groundskeeper | last post by:
I can't seem to get a custom UnhandledException handler working for a Windows Service I'm writing in VB.NET. I've read the MSDN and tried various different placements of the AddHandler call, to no avail. Here's the code I'm using, all of which is in the main service class: Protected Overrides Sub OnStart(ByVal args() As String) AddHandler AppDomain.CurrentDomain.UnhandledException, _
0
2183
by: PhilHip | last post by:
I've written a Windows service in VB.Net that accesses the global address list to obtain all the entries to store them in a local database. The GAL is accessed using the MS Exchange profile on the current machine. The service then creates a new MAPI session and then attempts to log on to the session using the current MS Exchange profile on the machine. Here is the section of code that is erroring: Dim oSession As MAPI.Session...
2
2455
by: Trevor | last post by:
Argh! This problem is driving me nuts! Can you help? In November of 2003, I installed a web service on Windows Server 2003 built in VB.NET for v1.1.4322 of the framework. It contains a timer (System.Timers.Timer) which has an interval of 24 hours. Actually, it reads a time like 2AM out of the config file, and calculates the time between the start of the service to 2AM, and sets the timer. When the timer expires, it re-reads the...
7
7228
by: shai | last post by:
I am working at .net 1.1, writing in c#. I have windows service with a COM object. Every unexpected time The COM object throw an error that make my service get stuck (do not respond). I can catch this error. I want to restart my windows service every time the COM object throws an error. I use System.ServiceProcess.ServiceController to stop and start my service. But there is one thing I do not understand:
0
8594
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9076
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8947
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7621
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6454
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5810
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4321
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
2219
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
1952
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.