Problem moving windows service to .Net 2 environment

A

Al Norman

Hi. We have a bunch of Windows services that were developed in VS2003 using
..Net 1.1. Having moved to VS2005 and re-built them under .Net 2.0, they no
longer start. We are getting an Event Type clr20r3
System.Security.SecurityException (4436). The service code itself is a
mixture of managed and unmanaged (C++) code. The managed code implements the
interface to the service control manager (start/stop service), while the
unmanaged code does all of the heavy lifting.

I am assuming I need to configure the security rights for the service
executable to get around this problem -- but I have not been able to figure
out how to do this. Any hints from anyone?

thanks

al
 
S

Steven Cheng[MSFT]

Hello Norman,

From your description, you have originally developed many windows NT
service application upon .net framework 1.1 and when you recompile them
through .net framework 2.0 and running again, they stop working, and will
report some System.Security.SecurityException (4436) , correct?

As for this problem , I've just performed some research against our product
issue database and haven't found existing known issue on this. I think this
is likely a program specific issue. As you mentioned that the program is a
mixture of managed and unmanged code, this is the potential cause, would
you provide some detailed info about the code logic of the service program
such as how the managed part launch the unmanaged part to do the main task?

So far I would suggest you test through the following steps:

1. Since the exception is a security exception which is normally caused by
net code access security checking, you can try temporarily turn off the
CAS checking on your test machine to see whether the exception still occur
or change to a different behavior. To turnoff CAS temporarily, you can use
the caspol.exe tool:

#Code Access Security Policy Tool (Caspol.exe)
http://msdn2.microsoft.com/en-us/library/cb6t8dtz.aspx

2. Use some debugger like visual studio to attache your windows service
program, you can set some break point at the access point where your
managed handler launch unmanaged components, I think it is likely at those
points the exception be thrown.

Please feel free to let me know if you have any other finding.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead



==================================================

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top