Hi
I need some help.
I've converted an old VB6 application into a VB .NET AddIn.
It works fine on my own computer (where it is developed) but I can't make the application work on any other computer.
An expression with the following text is thrown:
"System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Security.SecurityException: That assembly does not allow partially trusted callers.
at MSOIS2LDB.MSOIS2LDB.MSOIS2LDB..ctor(IntPtr mdlDesc)
The action that failed was:
Link demand
...
..."
I hope that someone can give me a tip to what I'm missing or doing wrong.
Thanks in advance
Regards,
Evan
It looks like you have problems with addins constructor. How do you construct Addin derived class?
Is your application web-based?
In other words, you need full-trust to run that assembly, so may be this link could help you.
Dan
Hi Dan
The constructor is very simple:
Sub New(ByVal mdlDesc As System.IntPtr)
MyBase.New(mdlDesc)
s_App = Me
End Sub
My application is not web-based.
I've had a look at the link and I've added the following line to AssemblyInfo.vb file:
<Assembly: Security.AllowPartiallyTrustedCallers()>
The result is still the same...
Is your application stored on a network-drive?
If so, try to store it on a local drive, to prove it.
Mit freundlichen Grüßen / Best regards Volker Hüfner
| AB_DATE Engineering Software | ab-date.de |
Hi Volker
That was the keyword. When my application is stored on a local drive it works fine. Thank you very much for your help.
Is there a way to make the application work when stored on a network drive ?
Unknown said:<Assembly: Security.AllowPartiallyTrustedCallers()>
This makes only your assembly available for partially trusted callers, but to run Addin, you need full trust, but this is probably that you understand now...
To run from network you can try CASPOL.exe, google for more info...
Thank you for the tip..
Yes, it seems that CASPOL.exe is a good tool but one of the links tells me that it is obsolete....
When we embrace .NET we also embrace, whether or not we want to, Microsoft's security model. Your questions are not specific to MicroStation but generic .NET. You will find plenty of information on .NET web sites: Google is your friend.
Regards, Jon Summers LA Solutions
One way to get around the dll's not running on the network is to copy it to a local location everytime you start up microstation, and load it from there. Now, a question I would ask is how do you do that in microstation? In autocad I used lisp to do the copying on application startup, but I'm not aware of any code you can execute in microstation on application startup.