473,698 Members | 2,747 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Diagnostics.Pro cess starts exe's which raise SecurityExcepti on's

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.Diagnost ics.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.Diagnost ics.Process macro = new
System.Diagnost ics.Process(); macro.StartInfo .FileName =
fp.MacroFilePat hName;
macro.StartInfo .Arguments = this.feedProces sXMLDirprocess_ " +
fp.FeedFileName + ".xml";
macro.StartInfo .Arguments += " " + fp.ProductionRu n.ToString();
macro.StartInfo .CreateNoWindow = true;
macro.Start();
macro.WaitForEx it(); //macro.WaitForEx it(5000)
// keep track of all log files.
this.logs.Add(f p.LogFileDir + "\\" +
this.feedProces sXMLLogFileName Header + fp.LogFileName +
FeedProcess.dat eToDirString(th is.currentDate, fp.FeedFileDest inationDirForma t)
+ ".xml"); this.numMacros+ +;
}catch (Exception ex)
Exception raised by started console apps:
System.Security .SecurityExcept ion: Request for the permission of type
System.Sec
urity.Permissio ns.FileIOPermis sion, mscorlib, Version=1.0.500 0.0,
Culture=neutra
l, PublicKeyToken= b77a5c561934e08 9 failed.
at
System.Security .CodeAccessSecu rityEngine.Chec kHelper(Permiss ionSet
granted
Set, PermissionSet deniedSet, CodeAccessPermi ssion demand,
PermissionToken permT
oken)
at System.Security .CodeAccessSecu rityEngine.Chec k(PermissionTok en
permToken,
CodeAccessPermi ssion demand, StackCrawlMark& stackMark, Int32
checkFrames, Int32
unrestrictedOve rride)
at
System.Security .CodeAccessSecu rityEngine.Chec k(CodeAccessPer mission
cap, S
tackCrawlMark& stackMark)
at System.Security .CodeAccessPerm ission.Demand()
at System.IO.Path. GetFullPath(Str ing path)
at System.Xml.XmlR esolver.Resolve Uri(Uri baseUri, String
relativeUri)
at System.Xml.XmlT extReader..ctor (String url, XmlNameTable nt)
at System.Xml.XmlT extReader..ctor (String url)
at FeedProcessClas sLibrary.FeedPr ocess.parseXML( String xmlFile)
at FeedProcessClas sLibrary.FeedMa cro..ctor(Strin g
feedProcessXMLF ilePath, Boo
lean production)
at TestMacro.TestM acro.Main(Strin g[] args)

Sorry for such a long post, any help would be much appreciated.

Nov 24 '05 #1
7 2883
From where are you attempting to load the target executable? (i.e.: What
does fp.MacroFilePat hName return?)

"Phil Mc" <ph**********@p ramerica.ie> wrote in message
news:11******** **************@ f14g2000cwb.goo glegroups.com.. .
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.Diagnost ics.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.Diagnost ics.Process macro = new
System.Diagnost ics.Process(); macro.StartInfo .FileName =
fp.MacroFilePat hName;
macro.StartInfo .Arguments = this.feedProces sXMLDirprocess_ " +
fp.FeedFileName + ".xml";
macro.StartInfo .Arguments += " " + fp.ProductionRu n.ToString();
macro.StartInfo .CreateNoWindow = true;
macro.Start();
macro.WaitForEx it(); //macro.WaitForEx it(5000)
// keep track of all log files.
this.logs.Add(f p.LogFileDir + "\\" +
this.feedProces sXMLLogFileName Header + fp.LogFileName +
FeedProcess.dat eToDirString(th is.currentDate, fp.FeedFileDest inationDirForma t)
+ ".xml"); this.numMacros+ +;
}catch (Exception ex)
Exception raised by started console apps:
System.Security .SecurityExcept ion: Request for the permission of type
System.Sec
urity.Permissio ns.FileIOPermis sion, mscorlib, Version=1.0.500 0.0,
Culture=neutra
l, PublicKeyToken= b77a5c561934e08 9 failed.
at
System.Security .CodeAccessSecu rityEngine.Chec kHelper(Permiss ionSet
granted
Set, PermissionSet deniedSet, CodeAccessPermi ssion demand,
PermissionToken permT
oken)
at System.Security .CodeAccessSecu rityEngine.Chec k(PermissionTok en
permToken,
CodeAccessPermi ssion demand, StackCrawlMark& stackMark, Int32
checkFrames, Int32
unrestrictedOve rride)
at
System.Security .CodeAccessSecu rityEngine.Chec k(CodeAccessPer mission
cap, S
tackCrawlMark& stackMark)
at System.Security .CodeAccessPerm ission.Demand()
at System.IO.Path. GetFullPath(Str ing path)
at System.Xml.XmlR esolver.Resolve Uri(Uri baseUri, String
relativeUri)
at System.Xml.XmlT extReader..ctor (String url, XmlNameTable nt)
at System.Xml.XmlT extReader..ctor (String url)
at FeedProcessClas sLibrary.FeedPr ocess.parseXML( String xmlFile)
at FeedProcessClas sLibrary.FeedMa cro..ctor(Strin g
feedProcessXMLF ilePath, Boo
lean production)
at TestMacro.TestM acro.Main(Strin g[] args)

Sorry for such a long post, any help would be much appreciated.

Nov 24 '05 #2
Hi Nicole
I am attempting to run target exe on the some server (same dir in
fact). That is to sat the first exe is running(schedul ing program), and
it is attempting to start a second exe. The first app does not seem to
be raising any security exception, whereas the exe's started by this
app are causing problems.

The exe's are starting, but failing when an IO operations are
attempted.
thanks

Nov 24 '05 #3

"Phil Mc" <ph**********@p ramerica.ie> wrote in message
news:11******** *************@z 14g2000cwz.goog legroups.com...
Hi Nicole
I am attempting to run target exe on the some server (same dir in
fact). That is to sat the first exe is running(schedul ing program), and
it is attempting to start a second exe. The first app does not seem to
be raising any security exception, whereas the exe's started by this
app are causing problems.

The exe's are starting, but failing when an IO operations are
attempted.
thanks


Are both the exe's loaded from a local disk or from a network share?

Willy.
Nov 24 '05 #4
Hi Willy,
Both exes are loaded from the same folder at present, on the win 2003
server.
thanks

Nov 24 '05 #5

"Phil Mc" <ph**********@p ramerica.ie> wrote in message
news:11******** **************@ g44g2000cwa.goo glegroups.com.. .
Hi Willy,
Both exes are loaded from the same folder at present, on the win 2003
server.
thanks


I understand that, but the question is - do you run the code on the win 2003
server it is loaded from, or do you load the code from the server and run it
on another machine?
It looks like you are doing the latter, which obviously throws a
"FileIOPermissi on" security exception because (by default) code loaded from
non local storage has no FileIOPermissio n.

Willy.

Nov 24 '05 #6
Hi Willy
The code will run on the server itself, and is local on that server.
thanks

Nov 25 '05 #7
If the "macro" assembly is being loaded from a local path on the same
machine*, is it possible that the machine's CAS policy has been altered so
that locally run assemblies are no longer automatically granted unrestricted
permissions? If you can't tell from examining the CAS policy yourself, it
would probably be a good idea to ask the machine administrator about this.
*This means not even a UNC path pointing to a share on the same machine, but
a strictly local path like "C:\SomeDirecto ry\SomeAssembly .exe".

"Phil Mc" <ph**********@p ramerica.ie> wrote in message
news:11******** **************@ g14g2000cwa.goo glegroups.com.. .
Hi Willy
The code will run on the server itself, and is local on that server.
thanks

Nov 25 '05 #8

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

Similar topics

1
1194
by: JennL | last post by:
I have a web farm of 2 servers (so far). I have a script that creates ..HTML files and then I call a PDF writer to turn them into .pdf files. The problem is that I then have files on 2 different servers. I want to synchronize these servers so I write a VB.NET exe...which works if I run it manually when logged into the servers. The .exe copies any newer files to a non-web file server and also grabs any files from that server that are newer....
12
2936
by: serge calderara | last post by:
Dear all, I have an application which is suppose to start another executable process. As soon as that process is running, I need to retrive its handle. The problem of the particular process I am starting is that it has a welcome window first which gets displayed and then the real windows after a while,in other words it means that the process name is the same, but the handle I need to retrive is the one from the final window and not the...
0
1739
by: marccruz | last post by:
Given an instance of System.Diagnostics.Process, how can I get the parent process o Given an instance of System.Diagnostics.Process, how can I get the child processes For example, I start a process which executes a script that starts a java program System.Diagnostics.Process proc = System.Diagnostics.Process() proc.StartInfo.FileName = "test.bat"
1
5484
by: ginee lee via .NET 247 | last post by:
(Type your message here) hi all, It seems that the arguments of System.Diagnostics.Process.Start()can only be the absolute path. The args can not be like".\abc\efg.exe" or "..\abc\efg.exe". While i use relative path,the function doesn't work. Any solution?? The other question is... i take a example fisrt! System.Diagnostics.Process.Start("c:\\abc.exe", "hello.txt"); itworks fine. BUT if the second arg replace with "helloworld.exe",...
2
15470
by: andreas | last post by:
hi, In windows xp in the start launch menu when i put notepad "c:\test.txt" i get notepad with test.txt in it. in vb.net when i state system.diagnostics.process.start("notepad.exe" i get notepad but
1
4847
by: Brad | last post by:
I have an issue trying to execute commands in a web service. The command starts under the specified user. However, it never completes its execution. I can execute simple commands like "echo HELLO" and cmd.exe starts but never terminates. I'm relatively new to .NET, so I may be forgetting some thing obvious. Thanks! Here's the code: using System; using System.Web; using System.Web.Services; using System.Web.Services.Protocols;
2
5005
by: Daniel | last post by:
System.Diagnostics.Process.Start fails on windows server 2003 the process returns process.ExitCode == 0 but executing any process with System.Diagnostics.Process.Start on windows xp works fine. anything to do different for windows server 2003? some special permission for the process that executes another executable with System.Diagnostics.Process.Start ?? here is the code:
5
3298
by: Saya | last post by:
Hi Folks, I have now spend app. 3 days to get the below scenario to work, but can not get there! ..Net version = 2.0.50727 Windows version = Microsoft Windows = Windows Server 2003 Now I have to develop a webservice which is run on the server. The
3
3190
by: Bali | last post by:
Hi I have an ASP.NET application. I am on the server side and trying to start an application which is on the server. The process gets started(can be seen in the Task Manager) but doesn't do anything(00 CPU cycles). System.Diagnostics.Process.Start("c:\\Code\\testExe\\test.exe"); Now I have gone to the testExe folder and given both ASPNet and
0
8683
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
8611
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9170
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...
1
8904
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7741
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...
0
5867
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
4372
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...
0
4624
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2007
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.