Hi all
I have a small scheduling application that I have written which will be
running on a Windows 2003 server. This application is started at
different times by an 'autosys' job (though I am testing by
manually starting the app from the server, that is logging into the
server, and running).
This app depending on available resources (txt, xml data files), starts
simple exe console apps which load simple data feeds into an SQL db. In
this operation file IO operations are required (such as copying and
directory creation) by the scheduler app, and simple files resource
checks (FileExists(xxx.txt), are carried out by the simple console
apps. All works as expected when run from my workstation.
The problem I have is that the console apps raise IO security
exceptions when run on the server. That when I deploy the scheduler and
associated console apps, the console apps raise exceptions. These
simple console apps are started in my scheduler app by using the
System.Diagnostics.Process CLASS. The scheduler does not cause problems
although it carries much of the IO work (the app I start manually). The
app which are started by the scheduler are the ones causing all the
problems.
Code to start the process which run the console apps:
DateTime start = DateTime.Now;
try
{
// run the appropriate macro
System.Diagnostics.Process macro = new
System.Diagnostics.Process(); macro.StartInfo.FileName =
fp.MacroFilePathName;
macro.StartInfo.Arguments = this.feedProcessXMLDirprocess_" +
fp.FeedFileName + ".xml";
macro.StartInfo.Arguments += " " + fp.ProductionRun.ToString();
macro.StartInfo.CreateNoWindow = true;
macro.Start();
macro.WaitForExit(); //macro.WaitForExit(5000)
// keep track of all log files.
this.logs.Add(fp.LogFileDir + "\\" +
this.feedProcessXMLLogFileNameHeader + fp.LogFileName +
FeedProcess.dateToDirString(this.currentDate,fp.FeedFileDestinationDirFormat)
+ ".xml"); this.numMacros++;
}catch (Exception ex)
Exception raised by started console apps:
System.Security.SecurityException: Request for the permission of type
System.Sec
urity.Permissions.FileIOPermission, mscorlib, Version=1.0.5000.0,
Culture=neutra
l, PublicKeyToken=b77a5c561934e089 failed.
at
System.Security.CodeAccessSecurityEngine.CheckHelper(PermissionSet
granted
Set, PermissionSet deniedSet, CodeAccessPermission demand,
PermissionToken permT
oken)
at System.Security.CodeAccessSecurityEngine.Check(PermissionToken
permToken,
CodeAccessPermission demand, StackCrawlMark& stackMark, Int32
checkFrames, Int32
unrestrictedOverride)
at
System.Security.CodeAccessSecurityEngine.Check(CodeAccessPermission
cap, S
tackCrawlMark& stackMark)
at System.Security.CodeAccessPermission.Demand()
at System.IO.Path.GetFullPath(String path)
at System.Xml.XmlResolver.ResolveUri(Uri baseUri, String
relativeUri)
at System.Xml.XmlTextReader..ctor(String url, XmlNameTable nt)
at System.Xml.XmlTextReader..ctor(String url)
at FeedProcessClassLibrary.FeedProcess.parseXML(String xmlFile)
at FeedProcessClassLibrary.FeedMacro..ctor(String
feedProcessXMLFilePath, Boo
lean production)
at TestMacro.TestMacro.Main(String[] args)
Sorry for such a long post, any help would be much appreciated.