G
Guest
From the amount of articles about this one I’m sure this gets asked a lot,
but I haven’t yet found a succinct article which explains what is required in
its entirety.
I work using Visual Studio 2005 SP1 mainly in ASP.Net using VB.Net 2.0.
I have an application which runs without error on my development server so I
believe that the underlying code is correct.
Most of my applications including this one runs on a shared server (Win
2003) that my hosting provider runs in medium trust. I understand from
background reading that because of the trust issue certain ASP.Net 2.0
assemblies require additional alterations to their compilations files to
allow other assemblies to call there methods etc.
The application is set up so that the main application (project) has a
reference to a second project (the business layer) within the solution, where
most of the code is kept and maintained. Compilation of the business layer
passes the dll to the bin folder of the main application and then the
application including the dll in the bin folder is copied across to the live
server.
When I run the application on the live server I get the error “That assembly
does not allow partially trusted callersâ€
After background reading I added the line –
<Assembly: AllowPartiallyTrustedCallersAttribute()>
into the AssemblyInfo.vb file along with an “Imports System.Securityâ€
I could find no mention of where in the file this line should be added so I
assume this is of no importance.
I recompiled the application and uploaded it again but the error was still
present. Further research suggested that the assembly should have a “Strong
Name†so I went to the signing tab of the project settings and ticked the box
to “Sign the assembly†I then created a new “strong name key file†there were
none before this and the key “keyname.pfx†appeared in the business layer
project folder.
This is where I became stuck! I can find no reference explaining what I am
supposed to do with the key although I assume it is required on the live
server so that the business layer dll file can be referenced. I have uploaded
the new dll but the application still fails. I tried adding the key to the
bin folder on the live application but that didn’t help matters.
Any advice on the above or anybody know one good article which explains the
whole thing.
but I haven’t yet found a succinct article which explains what is required in
its entirety.
I work using Visual Studio 2005 SP1 mainly in ASP.Net using VB.Net 2.0.
I have an application which runs without error on my development server so I
believe that the underlying code is correct.
Most of my applications including this one runs on a shared server (Win
2003) that my hosting provider runs in medium trust. I understand from
background reading that because of the trust issue certain ASP.Net 2.0
assemblies require additional alterations to their compilations files to
allow other assemblies to call there methods etc.
The application is set up so that the main application (project) has a
reference to a second project (the business layer) within the solution, where
most of the code is kept and maintained. Compilation of the business layer
passes the dll to the bin folder of the main application and then the
application including the dll in the bin folder is copied across to the live
server.
When I run the application on the live server I get the error “That assembly
does not allow partially trusted callersâ€
After background reading I added the line –
<Assembly: AllowPartiallyTrustedCallersAttribute()>
into the AssemblyInfo.vb file along with an “Imports System.Securityâ€
I could find no mention of where in the file this line should be added so I
assume this is of no importance.
I recompiled the application and uploaded it again but the error was still
present. Further research suggested that the assembly should have a “Strong
Name†so I went to the signing tab of the project settings and ticked the box
to “Sign the assembly†I then created a new “strong name key file†there were
none before this and the key “keyname.pfx†appeared in the business layer
project folder.
This is where I became stuck! I can find no reference explaining what I am
supposed to do with the key although I assume it is required on the live
server so that the business layer dll file can be referenced. I have uploaded
the new dll but the application still fails. I tried adding the key to the
bin folder on the live application but that didn’t help matters.
Any advice on the above or anybody know one good article which explains the
whole thing.