Filesystemwatcher securityexception

E

E Stafford

I am using Visual C# Express and trying to place a FileSystemWatcher in
my app. after adding it and trying to run it throws an exception from
InitiateComponents().

system.security.SecurityException request failed.
Any Idea how to fix this...?

already tried a couple things with no success.
1. project properties .. security tab.
2. chanded microsoft .net framework 2.0 configuration in admin tools

exception text
-------------

System.Security.SecurityException was unhandled
Message="Request failed."
Source="NewmanCentral_dot_Net"
StackTrace:
at
System.Security.CodeAccessSecurityEngine.ThrowSecurityException(Assembly
asm, PermissionSet granted, PermissionSet refused, RuntimeMethodHandle
rmh, SecurityAction action, Object demand, IPermission permThatFailed)
at
System.Security.CodeAccessSecurityEngine.ThrowSecurityException(Object
assemblyOrString, PermissionSet granted, PermissionSet refused,
RuntimeMethodHandle rmh, SecurityAction action, Object demand,
IPermission permThatFailed)
at
System.Security.CodeAccessSecurityEngine.CheckSetHelper(PermissionSet
grants, PermissionSet refused, PermissionSet demands,
RuntimeMethodHandle rmh, Object assemblyOrString, SecurityAction action,
Boolean throwException)
at
System.Security.CodeAccessSecurityEngine.CheckSetHelper(CompressedStack
cs, PermissionSet grants, PermissionSet refused, PermissionSet demands,
RuntimeMethodHandle rmh, Assembly asm, SecurityAction action)
at NewmanCentral_dot_Net.main.InitializeComponent()
at NewmanCentral_dot_Net.main..ctor()
at NewmanCentral_dot_Net.Program.Main()
at System.AppDomain.nExecuteAssembly(Assembly assembly, String[]
args)
at System.Runtime.Hosting.ManifestRunner.Run(Boolean
checkAptModel)
at System.Runtime.Hosting.ManifestRunner.ExecuteAsAssembly()
at
System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationCon
text activationContext, String[] activationCustomData)
at
System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationCon
text activationContext)
at
Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssemblyDebugInZo
ne()
at System.Threading.ThreadHelper.ThreadStart_Context(Object
state)
at System.Threading.ExecutionContext.runTryCode(Object userData)
at
System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteed
Cleanup(TryCode code, CleanupCode backoutCode, Object userData)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext
executionContext, ContextCallback callback, Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext
executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()

This email was sent from Newman Communications by Edward Stafford and is
intended for (e-mail address removed).
If you believe you received this message in error or do not wish to
receive messages from Newman Communications, please contact sender by
replying to this message.

Thank You,
 
G

Guest

Have you checked to see that the user account this appliation runs under
actually has ACL folder / file access permission to this folder and its
files? That you do with windows explorer - right click the folder and check
the Security Tab.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com




E Stafford said:
I am using Visual C# Express and trying to place a FileSystemWatcher in
my app. after adding it and trying to run it throws an exception from
InitiateComponents().

system.security.SecurityException request failed.
Any Idea how to fix this...?

already tried a couple things with no success.
1. project properties .. security tab.
2. chanded microsoft .net framework 2.0 configuration in admin tools

exception text
-------------

System.Security.SecurityException was unhandled
Message="Request failed."
Source="NewmanCentral_dot_Net"
StackTrace:
at
System.Security.CodeAccessSecurityEngine.ThrowSecurityException(Assembly
asm, PermissionSet granted, PermissionSet refused, RuntimeMethodHandle
rmh, SecurityAction action, Object demand, IPermission permThatFailed)
at
System.Security.CodeAccessSecurityEngine.ThrowSecurityException(Object
assemblyOrString, PermissionSet granted, PermissionSet refused,
RuntimeMethodHandle rmh, SecurityAction action, Object demand,
IPermission permThatFailed)
at
System.Security.CodeAccessSecurityEngine.CheckSetHelper(PermissionSet
grants, PermissionSet refused, PermissionSet demands,
RuntimeMethodHandle rmh, Object assemblyOrString, SecurityAction action,
Boolean throwException)
at
System.Security.CodeAccessSecurityEngine.CheckSetHelper(CompressedStack
cs, PermissionSet grants, PermissionSet refused, PermissionSet demands,
RuntimeMethodHandle rmh, Assembly asm, SecurityAction action)
at NewmanCentral_dot_Net.main.InitializeComponent()
at NewmanCentral_dot_Net.main..ctor()
at NewmanCentral_dot_Net.Program.Main()
at System.AppDomain.nExecuteAssembly(Assembly assembly, String[]
args)
at System.Runtime.Hosting.ManifestRunner.Run(Boolean
checkAptModel)
at System.Runtime.Hosting.ManifestRunner.ExecuteAsAssembly()
at
System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationCon
text activationContext, String[] activationCustomData)
at
System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationCon
text activationContext)
at
Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssemblyDebugInZo
ne()
at System.Threading.ThreadHelper.ThreadStart_Context(Object
state)
at System.Threading.ExecutionContext.runTryCode(Object userData)
at
System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteed
Cleanup(TryCode code, CleanupCode backoutCode, Object userData)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext
executionContext, ContextCallback callback, Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext
executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()

This email was sent from Newman Communications by Edward Stafford and is
intended for (e-mail address removed).
If you believe you received this message in error or do not wish to
receive messages from Newman Communications, please contact sender by
replying to this message.

Thank You,
 
E

E Stafford

Peter said:
Have you checked to see that the user account this appliation runs under
actually has ACL folder / file access permission to this folder and its
files? That you do with windows explorer - right click the folder and check
the Security Tab.
Peter

Thank you Peter for the response.
Yes I have full permissions to the domain and local system.

One thing I did see mentioned in other web and newsgroup posts is the
problem with accessing solutions on a network drive. Our documents
folders are mapped to a netowrk drive. What seems to work as a solution
was to move the entire project to a local drive and change the solution
security preferences to full Trust.

So far, all is working fine when executed in the debugger.

thanks
 

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