RE: VB.NET Win Service throws SecurityException on ServiceControll
- From: MaxGruven <MaxGruven@xxxxxxxxxxxxxxxx>
- Date: Wed, 14 May 2008 15:17:01 -0700
Thanks for your help Jeffrey!
This WinService tries to close itself when it gets an SQL Error trying to
get to the database. This all happens when a message is received on an MSMQ.
We catch the SqlException, do some logging and other clean up and then try
and shutdown the service so that it will cause a monitoring program to go
into alarm state and notify operations.
It is almost impossible for me to get a stack trace at this point however,
here is the Event Log entry that pointed me to the problem:
-----------------------------------------------------------------
Event Type:
Failure Audit
Event Source:
Security
Event Category:
Object Access
Event ID:
560
Date:
4/29/2008
Time:
2:23:42 AM
User:
2KAPPS\powr_winservice
Computer:
2KIISSTAG2
Description:
Object Open:
Object Server:
SC Manager
Object Type:
SERVICE OBJECT
Object Name:
POWRWinService
New Handle ID:
-
Operation ID:
{0,316750120}
Process ID:
320
Primary User Name:
2KIISSTAG2$
Primary Domain:
2KAPPS
Primary Logon ID:
(0x0,0x3E7)
Client User Name:
powr_winservice
Client Domain:
2KAPPS
Client Logon ID:
(0x0,0x1FA43)
Accesses
Stop the service
Privileges
-
------------------------------------------------------
This event happened trying to execute this code:
Dim oServiceController As New
ServiceController("PowrWinService")
oServiceController.Stop()
In the finally clause of the try catch that caught the SqlException.
Please let me know if you need more information.
TIA,
George
""Jeffrey Tan[MSFT]"" wrote:
Hi,.
Can you tell me where you run your ServiceController.Close() code?
SecurityException is normally thrown because of the .Net Code Access
Permission. Based on my research, there is a ServiceControllerPermission, I
suspect the code group you run may be lack of the
ServiceControllerPermission which caused the SecurityException. To verify
this, you may check SecurityException.PermissionType property. To help us
further understand this problem, can you post the stack trace of this
SecurityException? It may reveal the call path of this failure and find the
culprit.
Since you mentioned the user account is not Administrator, have you tried
to run your code under the Administrator account? Does the problem go away
under the Administrator account? If so, this SecurityException may be
caused by the native Windows service ACL settings permission issue.
Anyway, if we can get the call stack for this SecurityException and other
detailed information to analysis, we will can help you better. Thanks.
Best regards,
Jeffrey Tan
Microsoft Online Community Support
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
msdnmg@xxxxxxxxxxxxxx
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
- Follow-Ups:
- RE: VB.NET Win Service throws SecurityException on ServiceControll
- From: "Jeffrey Tan[MSFT]"
- RE: VB.NET Win Service throws SecurityException on ServiceControll
- References:
- VB.NET Win Service throws SecurityException on ServiceController.C
- From: MaxGruven
- RE: VB.NET Win Service throws SecurityException on ServiceController.C
- From: "Jeffrey Tan[MSFT]"
- VB.NET Win Service throws SecurityException on ServiceController.C
- Prev by Date: RE: Application icon in Security Warning dialog
- Next by Date: Re: Signing hash
- Previous by thread: RE: VB.NET Win Service throws SecurityException on ServiceController.C
- Next by thread: RE: VB.NET Win Service throws SecurityException on ServiceControll
- Index(es):
Relevant Pages
|