For the application I write, client requires that dll’s can’t be placed in GAC. So where do put them? In the bin of course. Writting “bin” I mean “C:\inetpub\wwwroot\wss\VirtualDirectories\port_number\bin”. Placing dll’s in the bin is somehow troublesome in the configuration, but also has some advantages – f.e. You don’t have to run iisreset everytime You change something in Your code.

To get Your dll’s running from bin You have to:

  1. Open Your web.config file and find node <trust level=”Security Level Goes Here” originUrl=”” />
  2. If level equals”Full” then go to step 5 else continue to step 3.
  3. Find trust level node with name equal to level from above node, f.e. if level from step 1 would be equal to “WSS_Minimal” then I should look for node <trustLevel name=”WSS_Minimal” policyFile=”C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\config\wss_minimaltrust.config” />
  4. Go to the file from “policyFile” attribute and modifie it. Find the tag <CodeGroup>, which has a “class” attribute equal to “FirstMatchCodeGroup” and paste this code right under it:
    <CodeGroup version=”1″ PermissionSetName=”FullTrust” Name=”Your_Dll_Strong_Name”> <IMembershipCondition class=”StrongNameMembershipCondition” version=”1″ PublicKeyBlob=”very long number :)”/></CodeGroup>
    To get PublicKeyBlob go to (Disk):\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin and use secutil.exe like this:
    secutil.exe -hex -s Exact_Path_To_Your_Dll > PublicKeyBlob.txt.
    Next, copy the key from the newly created PublicKeyBlob.txt
  5. Every dll placed in the bin folder has to have a special attribute that allows to run dll’s from bin.
    In Your solution in every project go to Properties/AssemblyInfo.cs and add this attribute:
    [assembly: AllowPartiallyTrustedCallers].
  6. Rebuild the solution and that’s it. Now You can copy dll’s to the bin folder and everything should work just as fine as it would be run from GAC.