That assembly does not allow partially trusted callers

  • Thread starter Thread starter mp
  • Start date Start date
M

mp

fwiw I'm a total newb to dotnet. trying to learn by doing. I started with
an app we purchased from an outside consultant(including source code).
Several things about it did not work properly so i'm in the process of
revising. Even with my limited knowlege i saw several things they did that
were not good coding, and have fixed.
but there are other areas I don't know about - i think there are parts of
their code i still have to remove but am working on over time.
my new dll "works" on my machine but i tried to set it up on a co-worker's
machine and get the following error:


Application does not support just-in-time (JIT)
debugging. See the end of this message for details.

************** Exception Text **************
System.Security.SecurityException: That assembly does not allow partially
trusted callers.
at MCS_PCMK.MCS.Init()
at MCS_PCMK.AcadCommands.XBOM()
at Autodesk.AutoCAD.Runtime.CommandClass.InvokeWorker(MethodInfo mi,
Object commandObject, Boolean bLispFunction)
at
Autodesk.AutoCAD.Runtime.CommandClass.InvokeWorkerWithExceptionFilter(MethodInfo
mi, Object commandObject, Boolean bLispFunction)
at Autodesk.AutoCAD.Runtime.PerDocumentCommandClass.Invoke(MethodInfo mi,
Boolean bLispFunction)
at Autodesk.AutoCAD.Runtime.CommandClass.CommandThunk.Invoke()
The action that failed was:
LinkDemand
The assembly or AppDomain that failed was:
MCS_PCMK, Version=1.1.1.0, Culture=neutral, PublicKeyToken=null
The method that caused the failure was:
System.String get_Name()
The Zone of the assembly that failed was:
Intranet
The Url of the assembly that failed was:
file:///S:/Design Team/Support/DotNet/MCSPieceMarker/Release/Mcs_pcmk.dll

I don't appear to have any security settings on that folder that would
prevent access, what else might cause this?
there is lots more in the error report but i didn't know how much to include
here...let me know if more is req'd for a possible answer

thanks
mark
 
mp said:
************** Exception Text **************
System.Security.SecurityException: That assembly does not allow partially
trusted callers.

I don't appear to have any security settings on that folder that would
prevent access, what else might cause this?
there is lots more in the error report but i didn't know how much to include
here...let me know if more is req'd for a possible answer

It's a .NET security trust level issue between the called and calling
assemblies. The .Net Framework security for each client machine the
assemblies are running on must be a Full Trust assembly.

<http://support.microsoft.com/kb/815147>

You can also put the assembly in the GAC on each machine, which makes it
a full trusted assembly too.
 
Mr. Arnold said:
It's a .NET security trust level issue between the called and calling
assemblies. The .Net Framework security for each client machine the
assemblies are running on must be a Full Trust assembly.

<http://support.microsoft.com/kb/815147>

You can also put the assembly in the GAC on each machine, which makes it a
full trusted assembly too.

Thank you Mr. Arnold.
I got to step 5 in those instructions and I get "Unable to load assembly:
...."
By assembly, does that mean the dll that I built in my project? that 's what
I browsed to.
What I've discovered is that if i try to run the dll from my computer it
works, if I put it on our server for common access I get that error in my
orig post (even on my machine- i was in error that it worked on mine but not
on the other - i was still running my local copy of the dll).
thanks
mark
 
mp said:
Thank you Mr. Arnold.
I got to step 5 in those instructions and I get "Unable to load assembly:
..."
By assembly, does that mean the dll that I built in my project? that 's what
I browsed to.

An assembly is a dll or an exe, as far as I know.
What I've discovered is that if i try to run the dll from my computer it
works,

That's because the assembly was compiled on your machine and is fully
trusted on your machine, when ran on your machine.
if I put it on our server for common access I get that error in my
orig post (even on my machine- i was in error that it worked on mine but not
on the other - i was still running my local copy of the dll).

That's because the .Net Framework security on the server is not set for
full trust for any remote client that needs to access the assembly.

Your easiest solution is to use the Gacutil for the .Net Framework
sitting on the server and put the assembly into the .Net Global Assembly
Cache on the server.

Your other option is to use the CasPol utility. It may come down to you
having to goto the .Net Machine.config on the server and set security
for the assembly, if not taking the GAC path in placing the assemble
into the server's .Net GAC.

<http://msdn.microsoft.com/en-us/library/cb6t8dtz(VS.80).aspx>
 
Mr. Arnold said:
An assembly is a dll or an exe, as far as I know.


That's because the assembly was compiled on your machine and is fully
trusted on your machine, when ran on your machine.


That's because the .Net Framework security on the server is not set for
full trust for any remote client that needs to access the assembly.

Your easiest solution is to use the Gacutil for the .Net Framework sitting
on the server and put the assembly into the .Net Global Assembly Cache on
the server.

Your other option is to use the CasPol utility. It may come down to you
having to goto the .Net Machine.config on the server and set security for
the assembly, if not taking the GAC path in placing the assemble into the
server's .Net GAC.

<http://msdn.microsoft.com/en-us/library/cb6t8dtz(VS.80).aspx>

Mr. Arnold,
Thank you for that clear and detailed answer.
Your easiest solution is to use the Gacutil for the .Net Framework sitting
on the server and put the assembly into the .Net Global Assembly Cache on
the server.
I'll have to research that, but i'm not sure they want me messing around
with the server.
From that link about caspol it sounded like I would change settings on the
client machines, not the server, maybe i mis read?
If i could do something to just our client machines - there are only 3 of us
here who need to use this app - that would be safer for me than doing
anything to the server - since i'm not an IT expert or a dot net expert I'm
hesitant to touch anything on the server (other than placing my files there
so we can all see the same version)
the other alternative sounds like i could copy my .dll to each machine and
maybe they would run locally - that would just mean more of a hassle for me
as i continue to tweak the program, and have to issue updates to the other
couple machines...no big deal, just thinking out loud.
your thoughts?
thanks
mark
 
mp said:
Mr. Arnold,
Thank you for that clear and detailed answer.
I'll have to research that, but i'm not sure they want me messing around
with the server.
From that link about caspol it sounded like I would change settings on the
client machines, not the server, maybe i mis read?
If i could do something to just our client machines - there are only 3 of us
here who need to use this app - that would be safer for me than doing
anything to the server - since i'm not an IT expert or a dot net expert I'm
hesitant to touch anything on the server (other than placing my files there
so we can all see the same version)
the other alternative sounds like i could copy my .dll to each machine and
maybe they would run locally - that would just mean more of a hassle for me
as i continue to tweak the program, and have to issue updates to the other
couple machines...no big deal, just thinking out loud.
your thoughts?

Deploy everything to the workstations where you have the control.
 
Back
Top