Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem running code stored on network yet works locally

Status
Not open for further replies.

ALWilliams

Programmer
Jun 29, 2007
21
GB

All,

I have been developing some vb .net 2008 code on my local machine and all has been fine.

I deceided to put the code on the network and off my local disk but every time I try and execute the code from this location I get a security error.

I have searched forums but cannot find a definitive answer as to how to solve this.

Any help much appreciated.

AL

I have pasted the results below. This is a very simple app which only uses a list box and reads in a number of text files to count some stats.

System.Security.SecurityException was unhandled
Message="Request for the permission of type 'System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed."
Source="WindowsApplication1"
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 WindowsApplication1.Form1.Form1_Load(Object sender, EventArgs e)
at System.EventHandler.Invoke(Object sender, EventArgs e)
at System.Windows.Forms.Form.OnLoad(EventArgs e)
at System.Windows.Forms.Form.OnCreateControl()
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.WmShowWindow(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ContainerControl.WndProc(Message& m)
at System.Windows.Forms.Form.WmShowWindow(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.SafeNativeMethods.ShowWindow(HandleRef hWnd, Int32 nCmdShow)
at System.Windows.Forms.Control.SetVisibleCore(Boolean value)
at System.Windows.Forms.Form.SetVisibleCore(Boolean value)
at System.Windows.Forms.Control.set_Visible(Boolean value)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(ApplicationContext context)
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
at WindowsApplication1.My.MyApplication.Main(String[] Args)
InnerException:
 
Try enabling ClickOnce = This is a full trust application in the properties of the application and recompiling.
 
Take a look at


Specifically 7 or 8 (I can't remember which one)

Your .Net needs to be told it can trust the "network residing" code.

=======================================
People think it must be fun to be a super genius, but they don't realize how hard it is to put up with all the idiots in the world. (Calvin from Calvin And Hobbs)

Robert L. Johnson III
CCNA, CCDA, MCSA, CNA, Net+, A+, CHDP
VB/Access Programmer
 
I only have version 1.1 on my machine yet am developing in 3.5. Should there be a 3.5 framework configuration option or is it all the same?
 
Mine says Framework 2.0, but I am mostly developing in 3.5 I don't have one listed for 1.1 or 3.5

I think it is the same.....

=======================================
People think it must be fun to be a super genius, but they don't realize how hard it is to put up with all the idiots in the world. (Calvin from Calvin And Hobbs)

Robert L. Johnson III
CCNA, CCDA, MCSA, CNA, Net+, A+, CHDP
VB/Access Programmer
 
I've done what the document says using 1.1 and still get the same error.
 
I've not run from a network share, but I don't see how it would be any different. If you are using framework 3.5 then it is going to require framework 3.5 on any computer trying to run the code.

-I hate Microsoft!
-Forever and always forward.
 
It is installed on both. The issue here is when the code is stored on a network location and loaded onto my laptop and run from my laptop I get this error.
 
Ah, so you have 3.5 installed, but you are only getting the configuration for 1.1. I misunderstood what you had said. As far as I know you don't have to have the configuration. They only way I know of to get it is to install the sdk (2.0, 3.0, 3.5) on that computer.

This may end up just like what they said in the link, but the one time I did it and it worked I opened the config and just selected the Runtime Security Policy. Under there it has Tasks and one is Increase Assembly Trust. I just went through that. Like I said the end result may end up the same as the link, but I didn't go through any of the steps they said.

-I hate Microsoft!
-Forever and always forward.
 
I relised last night that one of the first programs I did was actually on our network. hehe.

-I hate Microsoft!
-Forever and always forward.
 
I'm downloading the SDK now so will feed back if I cant get it to work - thanks so far!
 
I have installed this but I still no not have an option for framework 3.5!!
 
I just solved this problem here. Framework 3.0 and 3.5 are really using the base framework of 2.0.

I have a CAD application that gets updated constantly, so my desktoop shortcut for everyones computer runs it of a specific Drive/share on the network.

Here is a VB script snippet from my network login script that changes the policy

If objFSO.FileExists("C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\caspol.exe") Then
WSHShell.Run "C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\caspol.exe -pp off -m -ag 1.2 -url file://w:/cad-std/* FullTrust", HideWindow, WaitonReturn
End If
 
nice one - i solved it also myself by installing sdk 2.0 and applying full trust from there - cant believe the option wasnt in 3.5.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top