System.Security.SecurityException - NX4 VB .NET app on server share
System.Security.SecurityException - NX4 VB .NET app on server share
(OP)
Hi fellow forum members,
I am at a loss how to solve this issue. I developed an NX4 application and I am able to run this successfully locally. However, once moved to a server, a SecurityException is thrown.
I have done a lot of research but I haven't found a solution for my problem. I've tried to set the .NET 1.1 configuration on my computer and on the server but to no avail - I increased the LocalIntranet code set to FullTrust but it still does not work. Unfortunately I am not an expert how these security permissions work, only that something needs to be set, but I don't know what exactly!
An exerpt from my log file is below. I would appreciate any help! Thanks so much!!
AppBase: \\mrosmmf012\NX_4.0_Global\TDF_Tools\application\
Loaded assembly: System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a from c:\windows\assembly\gac\system.drawing\1.0.5000.0__b03f5f7f11d50a3a\system.drawing.dll
Loaded assembly: TDF_MIKRON_dwg_to_dxf, Version=0.1.11.2010, Culture=neutral, PublicKeyToken=null from \\mrosmmf012\nx_4.0_global\tdf_tools\application\tdf_mikron_dwg_to_dxf.dll
Loaded assembly: Microsoft.VisualBasic, Version=7.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a from c:\windows\assembly\gac\microsoft.visualbasic\7.0.5000.0__b03f5f7f11d50a3a\microsoft.visualbasic.dll
Caught exception while running: Main
System.TypeInitializationException: The type initializer for "TDF_MIKRON_dwg_to_dxf.EntryPoint" threw an exception. ---> System.Security.SecurityException: Request for the permission of type System.Security.Permissions.SecurityPermission, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 failed.
at TDF_MIKRON_dwg_to_dxf.EntryPoint..cctor()
The state of the failed permission was:
<IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"
Flags="UnmanagedCode"/>
--- End of inner exception stack trace ---
at TDF_MIKRON_dwg_to_dxf.EntryPoint.Main(String[] args)
*** EXCEPTION: Error code 67 in line 996 of O:\ugnx404\ip2\src\syss\no\ind\lmldr.c at Tue Nov 30 23:51:34 2010 W. Europe Standard Time
+++ The type initializer for "TDF_MIKRON_dwg_to_dxf.EntryPoint" threw an exception.
I am at a loss how to solve this issue. I developed an NX4 application and I am able to run this successfully locally. However, once moved to a server, a SecurityException is thrown.
I have done a lot of research but I haven't found a solution for my problem. I've tried to set the .NET 1.1 configuration on my computer and on the server but to no avail - I increased the LocalIntranet code set to FullTrust but it still does not work. Unfortunately I am not an expert how these security permissions work, only that something needs to be set, but I don't know what exactly!
An exerpt from my log file is below. I would appreciate any help! Thanks so much!!
AppBase: \\mrosmmf012\NX_4.0_Global\TDF_Tools\application\
Loaded assembly: System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a from c:\windows\assembly\gac\system.drawing\1.0.5000.0__b03f5f7f11d50a3a\system.drawing.dll
Loaded assembly: TDF_MIKRON_dwg_to_dxf, Version=0.1.11.2010, Culture=neutral, PublicKeyToken=null from \\mrosmmf012\nx_4.0_global\tdf_tools\application\tdf_mikron_dwg_to_dxf.dll
Loaded assembly: Microsoft.VisualBasic, Version=7.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a from c:\windows\assembly\gac\microsoft.visualbasic\7.0.5000.0__b03f5f7f11d50a3a\microsoft.visualbasic.dll
Caught exception while running: Main
System.TypeInitializationException: The type initializer for "TDF_MIKRON_dwg_to_dxf.EntryPoint" threw an exception. ---> System.Security.SecurityException: Request for the permission of type System.Security.Permissions.SecurityPermission, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 failed.
at TDF_MIKRON_dwg_to_dxf.EntryPoint..cctor()
The state of the failed permission was:
<IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
version="1"
Flags="UnmanagedCode"/>
--- End of inner exception stack trace ---
at TDF_MIKRON_dwg_to_dxf.EntryPoint.Main(String[] args)
*** EXCEPTION: Error code 67 in line 996 of O:\ugnx404\ip2\src\syss\no\ind\lmldr.c at Tue Nov 30 23:51:34 2010 W. Europe Standard Time
+++ The type initializer for "TDF_MIKRON_dwg_to_dxf.EntryPoint" threw an exception.





RE: System.Security.SecurityException - NX4 VB .NET app on server share
Hope it helps
Best regards,
Michaël.
NX4+TC9 / NX6+TC8Unified / NX7.5 native
RE: System.Security.SecurityException - NX4 VB .NET app on server share
Thanks a lot for your post. Unfortunately it did not work, as v1.0.5000.0 does not exist as a folder on the server and client under ...\Framework. The only folder containing caspol.exe is v1.1.4322. After updating the bat file and running it both on the client and the server, the issue still persists.
Is there a specific version of .NET framework I have to install?
RE: System.Security.SecurityException - NX4 VB .NET app on server share
On the client, I accessed the GUI version of caspol (Control Panel->Adminstrative Tools->Microsoft .NET Framework 1.1 Configuration) then carried out the following steps:
1. Under Runtime Security Policy->Machine->Code Groups->All_Code, I right-clicked and selected "New..."
2. In the upcoming dialog, I created a new code group, then clicked on Next.
3. In the condition type drop down list, I selected "URL".
4. In the now displayed text box, I typed "file://mrosmmf012/*", then clicked on Next.
5. In the last step I chose "FullTrust" in the drop down list under the "Use existing permission set" radio button.