I have created a console application in C# that appears to not even really
get started unless the code group in which it is contained is set to
FullTrusted. The Everything permission set does not even work. The
application never gets started far enough to get into any of my resource
usage (which is several FileIOPermission's). I do not have any assembly
level Permissions defined, and all of my FileIOPermission usages are
imperative.
The exact error message is:
Unhandled Exception: System.Security.SecurityException: Request failed.
at MyApp.Main(String[] args)
Additional information: Request failed.
I am running this from the command-line, not from the IDE.
--
James 9 2329
I did a little further testing and developed a small console application that
reproduces the problem:
using System;
using System.Diagnostics;
namespace Class1
{
/// <summary>
/// Summary description for Class1.
/// </summary>
// Set of required command-line options
class Tes123
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main(string[] args)
{
System.Diagnostics.FileVersionInfo versionInfo =
FileVersionInfo.GetVersionInfo("%systemroot%\\Note pad.exe");
Console.WriteLine(versionInfo.FileVersion);
}
}
}
If you comment out the GetVersionInfoLine (and place something else in the
WriteLine statement), you do not get the originally stated exception.
--
James
"James" wrote: I have created a console application in C# that appears to not even really get started unless the code group in which it is contained is set to FullTrusted. The Everything permission set does not even work. The application never gets started far enough to get into any of my resource usage (which is several FileIOPermission's). I do not have any assembly level Permissions defined, and all of my FileIOPermission usages are imperative.
The exact error message is:
Unhandled Exception: System.Security.SecurityException: Request failed. at MyApp.Main(String[] args) Additional information: Request failed.
I am running this from the command-line, not from the IDE. -- James
Hi James,
Thanks for your repro code. I tested it on my machine, however, it gave me
a FileNotFound exception. I made some changes to your code, and it works
fine on my machine.
string s = Environment.GetEnvironmentVariable("systemroot");
System.Diagnostics.FileVersionInfo versionInfo =
FileVersionInfo.GetVersionInfo(s + "\\Notepad.exe");
Console.WriteLine(versionInfo.FileVersion);
I think there might be some incorrect settings on you machine. I suggest
you try to use Microsoft .NET Framework 1.1 Configuration to check for the
required permission set for your assembly. Here are the steps:
1. Open Microsoft .NET Framework 1.1 Configuration in Administrative Tools.
2. In the left tree, select Runtime Security Policy.
3. Click Evaluate assembly from the right pane.
HTH.
Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
I left off the most important detail. The application runs as long as the
assembly is unsigned, or is delay-signed. Once I "fully" sign this app, it
produces the error mentioned in my original message.
--
James
"Kevin Yu [MSFT]" wrote: Hi James,
Thanks for your repro code. I tested it on my machine, however, it gave me a FileNotFound exception. I made some changes to your code, and it works fine on my machine.
string s = Environment.GetEnvironmentVariable("systemroot"); System.Diagnostics.FileVersionInfo versionInfo = FileVersionInfo.GetVersionInfo(s + "\\Notepad.exe"); Console.WriteLine(versionInfo.FileVersion);
I think there might be some incorrect settings on you machine. I suggest you try to use Microsoft .NET Framework 1.1 Configuration to check for the required permission set for your assembly. Here are the steps:
1. Open Microsoft .NET Framework 1.1 Configuration in Administrative Tools. 2. In the left tree, select Runtime Security Policy. 3. Click Evaluate assembly from the right pane.
HTH.
Kevin Yu ======= "This posting is provided "AS IS" with no warranties, and confers no rights."
And making sure I give every detail this time...
After signing the assembly, I create a code group in the .NET Configuration
Tool under the User node, that uses Strong Name as the evidence. It is in
this code group that I have to set FullTrust (vs. everything, or some subset)
to get the app to run.
--
James
"James" wrote: I left off the most important detail. The application runs as long as the assembly is unsigned, or is delay-signed. Once I "fully" sign this app, it produces the error mentioned in my original message. -- James "Kevin Yu [MSFT]" wrote:
Hi James,
Thanks for your repro code. I tested it on my machine, however, it gave me a FileNotFound exception. I made some changes to your code, and it works fine on my machine.
string s = Environment.GetEnvironmentVariable("systemroot"); System.Diagnostics.FileVersionInfo versionInfo = FileVersionInfo.GetVersionInfo(s + "\\Notepad.exe"); Console.WriteLine(versionInfo.FileVersion);
I think there might be some incorrect settings on you machine. I suggest you try to use Microsoft .NET Framework 1.1 Configuration to check for the required permission set for your assembly. Here are the steps:
1. Open Microsoft .NET Framework 1.1 Configuration in Administrative Tools. 2. In the left tree, select Runtime Security Policy. 3. Click Evaluate assembly from the right pane.
HTH.
Kevin Yu ======= "This posting is provided "AS IS" with no warranties, and confers no rights."
Hi James,
I followed your steps to add a new code group and assigned FullTrust or
Everything permission set to this code group. However, your code still
works fine on my machine. Have you tried to reproduce this with another
clean machine?
Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
Same on every machine I've tried. I did notice in the documentation for the
FileVersionInfo class that there is a LinkDemand requiring full trust: (see
note on http://msdn2.microsoft.com/en-us/lib...ileversioninfo)
--
James
"Kevin Yu [MSFT]" wrote: Hi James,
I followed your steps to add a new code group and assigned FullTrust or Everything permission set to this code group. However, your code still works fine on my machine. Have you tried to reproduce this with another clean machine?
Kevin Yu ======= "This posting is provided "AS IS" with no warranties, and confers no rights."
Hi James,
It seems that the .NET framework 2.0 requres full trust. I was testing on
the .NET framework 1.1.
Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
I am testing with the 1.1 Framework. I have the code group for the assembly
set to Exclusive ("this policy level will only have the permissions from the
permission set associated with this code group"). If I don't set that
property the assembly maintains Unrestricted trust and still runs.
--
James
"Kevin Yu [MSFT]" wrote: Hi James,
It seems that the .NET framework 2.0 requres full trust. I was testing on the .NET framework 1.1.
Kevin Yu ======= "This posting is provided "AS IS" with no warranties, and confers no rights."
Hi James,
Thanks for noticing me of checking this option. Now finally, I get this
issue reproed. Based on my research, the FileVersionInfo class requires
full trusted permission on the machine. If you use a .NET reflector to
check this class definition, you'll see the following attribute before the
definition.
[PermissionSet(SecurityAction.LinkDemand, Unrestricted=true)]
Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights." This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: MFRASER |
last post by:
I am getting a System.Security.SecurityException when I try and laod a
dataset from an xml file any ideas on what would cause this?
System.Security.SecurityException' occurred in mscorlib.dll
...
|
by: jwgoerlich |
last post by:
I wrote a simple VB.Net console application. It accepts command line
parameters and creates a folder structure. It works on the local file
system without a problem
If I run the console app from...
|
by: Dave Stewart |
last post by:
I recently wrote my first Vb.net application, or at least my first complex app since moving up from vb6. When run from the VS.NET IDE, the program shows no errors and runs fine. When the output exe...
|
by: Sabo, Eric |
last post by:
We are an educational environment, we are using VB .Net and Windows XP SP2.
The users are power users.
We have a Visual Basic .Net class that is having trouble with their project,
they are getting...
|
by: James |
last post by:
I have created a console application in C# that appears to not even really
get started unless the code group in which it is contained is set to
FullTrusted. The Everything permission set does not...
|
by: Seok Bee |
last post by:
Dear Experts,
I've created a Console application to perform a checking of an Excel file.
During development using vb.net in Visual Studio 2005, the application is
running fine. I can get my...
|
by: John |
last post by:
I write a simple .NET client program that calls Java Web Services.
Unfortunately, when it runs, it has error "unhandled exception of type
'System.Security.SecurityException' occured in...
|
by: Ankit Aneja |
last post by:
This is my problem. I am using Visual 2003, .Net framework 1.1 and the
Application Block
I configured the DAAB using the Enterprise Library Configuration
now this is the error which is coming
...
|
by: jtnpham |
last post by:
This is code I created to add a record where the user inputs the new
text in textboxes:
Private Sub btnAdd_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles btnAdd.Click
City =...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
| |