473,388 Members | 1,355 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

Security Exception when deploying a VB.NET 2003 solution.

Hello all,

Note: This is the full version of a Post that I inadvertently sent before it
was complete.

About a year ago I wrote a VB.NET 2003 solution that consists of a number
of assemblies (1 EXE and 15 DLLS). As I recall, in order to deploy the
solution to a testing server I simply copied the contents of the Bin folder
in the development area where the compiled assemblies reside. Be patient
with me here, because I haven't used .NET since then ... our primary
development environment is still VB6, as we have a large application with 6
years devoted to it and are not quite ready to do a complete re-write in
..NET.

The .NET project which had been dormant for a year is now back in action. I
tried creating an MSI install project from within the solution. It appeared
to include the primary EXE all the necessary dependencies (I don't even
remember how I created that Installer at the moment).

The bottom line is that now when I try to deploy to either a Test Server
share or a local workstation (which is a member of a Domain), I get
Microsoft .NET security errors upon trying to start the Executable.

Examples:
Local Workstation:
"An unhandled exception has occurred....
"Access to the path 'C:\Program Files\Testing' is denied.

Server Share:
"The application attempted to perform an operation not allowed by the
security policy. The operation required the SecurityException. To grant this
application the required permission please contact your system
administrator, or use the Microsoft .NET security policy administrator."

So, I used the .NET 1.1 and 2.0 Configuration tools to try to create a
Runtime Security Code Group to allow the program to run. I don't remember
having to do this last year...strangely enough. I was not able to
successfully get the program to execute after a few hours of reading
documentation and trying different things in the Configuration tools. The
documentation and even the tools themselves are somewhat inscrutable to the
uninitiated. Even the fact that there are so many membership conditions is
confusing. A plain English explanation somewhere would be helpful.

I tried using the Wizard in .NET 1.1 to allow premissions for each and every
included assembly... no luck there.

I then went on tho use caspol.exe... here is an example of a v2.0 bat
file...
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CasP ol.exe -all -resolveperm
c:\dmedi\dmEDI.Client.exe
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CasP ol.exe -all -resolveperm
c:\dmedi\dmEDI.ClientModules.Context.Business.dll
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CasP ol.exe -all -resolveperm
c:\dmedi\dmEDI.ClientModules.Context.Configuration .dll
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CasP ol.exe -all -resolveperm
c:\dmedi\dmEDI.ClientModules.Context.Data.dll
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CasP ol.exe -all -resolveperm
c:\dmedi\dmEDI.ClientModules.Core.dll
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CasP ol.exe -all -resolveperm
c:\dmedi\dmEDI.ClientModules.FTP.Business.dll
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CasP ol.exe -all -resolveperm
c:\dmedi\dmEDI.ClientModules.FTP.Config.dll
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CasP ol.exe -all -resolveperm
c:\dmedi\dmEDI.LocalModules.Configuration.dll
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CasP ol.exe -all -resolveperm
c:\dmedi\dmEDI.LocalModules.Data.dll
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CasP ol.exe -all -resolveperm
c:\dmedi\dmEDI.LocalModules.Document.dll
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CasP ol.exe -all -resolveperm
c:\dmedi\dmEDI.LocalModules.Notice.dll
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CasP ol.exe -all -resolveperm
c:\dmedi\dmEDI.LocalModules.PL.dll
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CasP ol.exe -all -resolveperm
c:\dmedi\dmEDI.LocalModules.Sample.dll
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CasP ol.exe -all -resolveperm
c:\dmedi\dmEDI.LocalModules.Session.dll
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CasP ol.exe -all -resolveperm
c:\dmedi\dmEDI.LocalModules.Test.dll
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CasP ol.exe -all -resolveperm
c:\dmedi\dmEDI.WebServices.dll

Run in a command prompt, every command indicated SUCCESS. But no luck there
either. I fillowed up with the v1.1 version of the same.

I then tried following instructions from an MSDN lab exercise...

@rem - polchgprompt - Enables or disables the prompt that is displayed
@rem - whenever Caspol.exe is run using an option that
@rem - would cause policy changes.
@rem - addgroup - Adds a new code group to the code group hierarchy.
@rem - url - Specifies code that originates from the given URL.
@rem - name - specifies the scripting name for a code group to add.

CD \
PATH=%windir%\microsoft.net\framework\v1.1.4322\
caspol.exe -polchgprompt off -u -addgroup All_Code -url "C:\dmedi\*"
FullTrust -name "dmEDI_on_C_run"

caspol.exe -polchgprompt on
Pause

No good there either.

Finally I used the caspol commantd to suspend security checking altogether
caspol -e off.
No luck... I realize I only ran it in the v2.0 .NET folder.

There is an .SNK file in the development folder. The project still runs from
the Bin directory in the development folder without a problem. For now I
just provide my development
partner a link to that EXE so he could continue with his part of the project
(which he is writing in VB6... long story).

I must get back to another VB6 project due in one week.

Any help would be appreciated... thanks in advance. Sorry about the double
post.


Jun 19 '06 #1
2 2279
John,

It is hard to say how to fix the problem without knowing exactly what
your code is doing. Is it possible your program is trying to open a file in
c:\program files\testing that does not exist? Does the active directory give
the user have the proper permissions to access files in c:\program files\test?

Ken
---------------------------

"John Kotuby" wrote:
Hello all,

Note: This is the full version of a Post that I inadvertently sent before it
was complete.

About a year ago I wrote a VB.NET 2003 solution that consists of a number
of assemblies (1 EXE and 15 DLLS). As I recall, in order to deploy the
solution to a testing server I simply copied the contents of the Bin folder
in the development area where the compiled assemblies reside. Be patient
with me here, because I haven't used .NET since then ... our primary
development environment is still VB6, as we have a large application with 6
years devoted to it and are not quite ready to do a complete re-write in
..NET.

The .NET project which had been dormant for a year is now back in action. I
tried creating an MSI install project from within the solution. It appeared
to include the primary EXE all the necessary dependencies (I don't even
remember how I created that Installer at the moment).

The bottom line is that now when I try to deploy to either a Test Server
share or a local workstation (which is a member of a Domain), I get
Microsoft .NET security errors upon trying to start the Executable.

Examples:
Local Workstation:
"An unhandled exception has occurred....
"Access to the path 'C:\Program Files\Testing' is denied.

Server Share:
"The application attempted to perform an operation not allowed by the
security policy. The operation required the SecurityException. To grant this
application the required permission please contact your system
administrator, or use the Microsoft .NET security policy administrator."

So, I used the .NET 1.1 and 2.0 Configuration tools to try to create a
Runtime Security Code Group to allow the program to run. I don't remember
having to do this last year...strangely enough. I was not able to
successfully get the program to execute after a few hours of reading
documentation and trying different things in the Configuration tools. The
documentation and even the tools themselves are somewhat inscrutable to the
uninitiated. Even the fact that there are so many membership conditions is
confusing. A plain English explanation somewhere would be helpful.

I tried using the Wizard in .NET 1.1 to allow premissions for each and every
included assembly... no luck there.

I then went on tho use caspol.exe... here is an example of a v2.0 bat
file...
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CasP ol.exe -all -resolveperm
c:\dmedi\dmEDI.Client.exe
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CasP ol.exe -all -resolveperm
c:\dmedi\dmEDI.ClientModules.Context.Business.dll
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CasP ol.exe -all -resolveperm
c:\dmedi\dmEDI.ClientModules.Context.Configuration .dll
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CasP ol.exe -all -resolveperm
c:\dmedi\dmEDI.ClientModules.Context.Data.dll
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CasP ol.exe -all -resolveperm
c:\dmedi\dmEDI.ClientModules.Core.dll
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CasP ol.exe -all -resolveperm
c:\dmedi\dmEDI.ClientModules.FTP.Business.dll
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CasP ol.exe -all -resolveperm
c:\dmedi\dmEDI.ClientModules.FTP.Config.dll
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CasP ol.exe -all -resolveperm
c:\dmedi\dmEDI.LocalModules.Configuration.dll
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CasP ol.exe -all -resolveperm
c:\dmedi\dmEDI.LocalModules.Data.dll
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CasP ol.exe -all -resolveperm
c:\dmedi\dmEDI.LocalModules.Document.dll
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CasP ol.exe -all -resolveperm
c:\dmedi\dmEDI.LocalModules.Notice.dll
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CasP ol.exe -all -resolveperm
c:\dmedi\dmEDI.LocalModules.PL.dll
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CasP ol.exe -all -resolveperm
c:\dmedi\dmEDI.LocalModules.Sample.dll
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CasP ol.exe -all -resolveperm
c:\dmedi\dmEDI.LocalModules.Session.dll
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CasP ol.exe -all -resolveperm
c:\dmedi\dmEDI.LocalModules.Test.dll
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CasP ol.exe -all -resolveperm
c:\dmedi\dmEDI.WebServices.dll

Run in a command prompt, every command indicated SUCCESS. But no luck there
either. I fillowed up with the v1.1 version of the same.

I then tried following instructions from an MSDN lab exercise...

@rem - polchgprompt - Enables or disables the prompt that is displayed
@rem - whenever Caspol.exe is run using an option that
@rem - would cause policy changes.
@rem - addgroup - Adds a new code group to the code group hierarchy.
@rem - url - Specifies code that originates from the given URL.
@rem - name - specifies the scripting name for a code group to add.

CD \
PATH=%windir%\microsoft.net\framework\v1.1.4322\
caspol.exe -polchgprompt off -u -addgroup All_Code -url "C:\dmedi\*"
FullTrust -name "dmEDI_on_C_run"

caspol.exe -polchgprompt on
Pause

No good there either.

Finally I used the caspol commantd to suspend security checking altogether
caspol -e off.
No luck... I realize I only ran it in the v2.0 .NET folder.

There is an .SNK file in the development folder. The project still runs from
the Bin directory in the development folder without a problem. For now I
just provide my development
partner a link to that EXE so he could continue with his part of the project
(which he is writing in VB6... long story).

I must get back to another VB6 project due in one week.

Any help would be appreciated... thanks in advance. Sorry about the double
post.


Jun 19 '06 #2
Ken,

Thanks for responding.
Your question about opening a file that does not exist, got me to thinking
about what other files might be needed by the app.

I must confess that I did not write the entire .NET app from scratch. We
commissioned a consultant to create the template.
I just fleshed out the application to meet the requirements of our site. I
have just discovered that by copying a folder named Config along with the
Bin folder (which contains the compiled assemblies) to the same location
(folder) in the Testing share, I can run the application without the error:

"Access to the path 'C:\<anyfolder>\Testing' is denied."

The Config folder contains the files Local.Config and Context.Config, XML
files with <ModuleSettings> entries. Each contains a <ConnectionString>
entry that is used to connect to local SQL Server tables. That is why the
above error message is so confusing.

However, the other error caused by trying to run the application from
another workstation pointing to the same share on the network, :

"The application attempted to perform an operation not allowed by the
security policy. "

.... is indeed resolved by configuring the .NET security policy on the local
machine, and is apparrently unrelated to the first error.

Thanks again for your input Ken.
"Ken Tucker [MVP]" <Ke**********@discussions.microsoft.com> wrote in message
news:CB**********************************@microsof t.com...
John,

It is hard to say how to fix the problem without knowing exactly what
your code is doing. Is it possible your program is trying to open a file
in
c:\program files\testing that does not exist? Does the active directory
give
the user have the proper permissions to access files in c:\program
files\test?

Ken
---------------------------

"John Kotuby" wrote:
Hello all,

Note: This is the full version of a Post that I inadvertently sent before
it
was complete.

About a year ago I wrote a VB.NET 2003 solution that consists of a
number
of assemblies (1 EXE and 15 DLLS). As I recall, in order to deploy the
solution to a testing server I simply copied the contents of the Bin
folder
in the development area where the compiled assemblies reside. Be patient
with me here, because I haven't used .NET since then ... our primary
development environment is still VB6, as we have a large application with
6
years devoted to it and are not quite ready to do a complete re-write in
..NET.

The .NET project which had been dormant for a year is now back in action.
I
tried creating an MSI install project from within the solution. It
appeared
to include the primary EXE all the necessary dependencies (I don't even
remember how I created that Installer at the moment).

The bottom line is that now when I try to deploy to either a Test Server
share or a local workstation (which is a member of a Domain), I get
Microsoft .NET security errors upon trying to start the Executable.

Examples:
Local Workstation:
"An unhandled exception has occurred....
"Access to the path 'C:\Program Files\Testing' is denied.

Server Share:
"The application attempted to perform an operation not allowed by the
security policy. The operation required the SecurityException. To grant
this
application the required permission please contact your system
administrator, or use the Microsoft .NET security policy administrator."

So, I used the .NET 1.1 and 2.0 Configuration tools to try to create a
Runtime Security Code Group to allow the program to run. I don't remember
having to do this last year...strangely enough. I was not able to
successfully get the program to execute after a few hours of reading
documentation and trying different things in the Configuration tools. The
documentation and even the tools themselves are somewhat inscrutable to
the
uninitiated. Even the fact that there are so many membership conditions
is
confusing. A plain English explanation somewhere would be helpful.

I tried using the Wizard in .NET 1.1 to allow premissions for each and
every
included assembly... no luck there.

I then went on tho use caspol.exe... here is an example of a v2.0 bat
file...
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CasP ol.exe -all -resolveperm
c:\dmedi\dmEDI.Client.exe
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CasP ol.exe -all -resolveperm
c:\dmedi\dmEDI.ClientModules.Context.Business.dll
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CasP ol.exe -all -resolveperm
c:\dmedi\dmEDI.ClientModules.Context.Configuration .dll
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CasP ol.exe -all -resolveperm
c:\dmedi\dmEDI.ClientModules.Context.Data.dll
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CasP ol.exe -all -resolveperm
c:\dmedi\dmEDI.ClientModules.Core.dll
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CasP ol.exe -all -resolveperm
c:\dmedi\dmEDI.ClientModules.FTP.Business.dll
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CasP ol.exe -all -resolveperm
c:\dmedi\dmEDI.ClientModules.FTP.Config.dll
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CasP ol.exe -all -resolveperm
c:\dmedi\dmEDI.LocalModules.Configuration.dll
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CasP ol.exe -all -resolveperm
c:\dmedi\dmEDI.LocalModules.Data.dll
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CasP ol.exe -all -resolveperm
c:\dmedi\dmEDI.LocalModules.Document.dll
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CasP ol.exe -all -resolveperm
c:\dmedi\dmEDI.LocalModules.Notice.dll
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CasP ol.exe -all -resolveperm
c:\dmedi\dmEDI.LocalModules.PL.dll
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CasP ol.exe -all -resolveperm
c:\dmedi\dmEDI.LocalModules.Sample.dll
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CasP ol.exe -all -resolveperm
c:\dmedi\dmEDI.LocalModules.Session.dll
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CasP ol.exe -all -resolveperm
c:\dmedi\dmEDI.LocalModules.Test.dll
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CasP ol.exe -all -resolveperm
c:\dmedi\dmEDI.WebServices.dll

Run in a command prompt, every command indicated SUCCESS. But no luck
there
either. I fillowed up with the v1.1 version of the same.

I then tried following instructions from an MSDN lab exercise...

@rem - polchgprompt - Enables or disables the prompt that is displayed
@rem - whenever Caspol.exe is run using an option that
@rem - would cause policy changes.
@rem - addgroup - Adds a new code group to the code group hierarchy.
@rem - url - Specifies code that originates from the given URL.
@rem - name - specifies the scripting name for a code group to add.

CD \
PATH=%windir%\microsoft.net\framework\v1.1.4322\
caspol.exe -polchgprompt off -u -addgroup All_Code -url "C:\dmedi\*"
FullTrust -name "dmEDI_on_C_run"

caspol.exe -polchgprompt on
Pause

No good there either.

Finally I used the caspol commantd to suspend security checking
altogether
caspol -e off.
No luck... I realize I only ran it in the v2.0 .NET folder.

There is an .SNK file in the development folder. The project still runs
from
the Bin directory in the development folder without a problem. For now I
just provide my development
partner a link to that EXE so he could continue with his part of the
project
(which he is writing in VB6... long story).

I must get back to another VB6 project due in one week.

Any help would be appreciated... thanks in advance. Sorry about the
double
post.


Jun 19 '06 #3

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

Similar topics

1
by: Sam | last post by:
I have a desktop VB.Net application I developed locally. I uploaded it to a file server we have and the .Net Framework is installed on the file server. When I try to run the executable from the...
2
by: Matt Theule | last post by:
Where can I find information about Runtime Security Policies? I have a winform that is hosted in a webform that needs to access the filesystem. Using the Configuration mmc snapin, I have created a...
19
by: Diego F. | last post by:
I think I'll never come across that error. It happens when running code from a DLL that tries to write to disk. I added permissions in the project folder, the wwwroot and in IIS to NETWORK_SERVICE...
2
by: guy | last post by:
i have a simple (1 form) Winforms VB.net 2003 app and am migrating it to vb2005 testing both on the same box... if i run the 2003 version it works correctly, but the 2005 version fails when...
1
by: eisenb | last post by:
microsoft.public.dotnet.languages.vb.upgrade isn't getting much traffic, so I'll try here. Ours is a VB6 shop exploring .NET. First I wrote a new application with VB .NET 2003 to create a pdf...
3
by: steveeisen | last post by:
microsoft.public.dotnet.languages.vb.upgrade isn't getting much traffic, so I'll try here. Ours is a VB6 shop exploring .NET. First I wrote a new application with VB .NET 2003 to create a...
1
by: AnalogKid17 | last post by:
I'm getting this error when building and running an ASP solution that lives on a network folder (part of the prod web server). I was NOT getting this when working on the same *identical* solution...
4
by: wazdakka | last post by:
I have an Access application developed using Access 2003 that I am trying to distribute. I have used the Package and Deployment Wizard that comes with the Office 2003 Developers Kit, and have been...
7
by: PW | last post by:
Any suggestions, knowledge base articles, books? We are not going to go field level but now we have a couple clients that would like to limit what employees can see of our application (forms and...
0
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,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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...
0
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,...
0
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...
0
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.