How to Bin Deploy ASP.NET Assemblies on Shared Servers
Written by Abner Myloth Friday, 9 November 2012
On ASP.NET platform it is quite common to use 3rd party assemblies like MVC, MS chart controls to add features accessible from your code which are not present in the .NET framework by default.
In your development machine, you do this by installing the required assembly server-wide. Assemblies get installed in Global Assembly Cache (GAC) and all you need to do is to reference that in web.config file.
However, it may not be possible to install all these 3rd party assemblies in a shared server as different users might be using different versions of the same assembly.
Here comes the power of .NET framework which allows the assemblies to be deployed “locally”. The .NET framework first checks the bin folder for any assemblies before it checks the GAC. Deploying the assemblies involves the steps mentioned below:
1. Obtain the assemblies
If you have installed the assemblies in your development machine, you will find it there. Or, you can download it from the respective vendor’s site, say assume it is a MS chart control or new version of URL rewrite module, download the source and binaries, extract it to your development machine and locate the .dll file(s)
2. Upload the assembly
Create a bin folder outside of your application folder (if you are deploying your application to the root of the site, create a bin folder outside wwwroot folder) and upload the dll you extracted in #1.
3. Load the assembly in your application
This is the most important part and I would recommend having a .NET developer configure this as some assemblies require different definitions in the web.config file. A sample one looks like the one mentioned below:
type=”MODULE_TYPE, DLL_NAME” />
<add name=”MODULE” type=”MODULE_TYPE, DLL_NAME” />
<add name=”MODULE” type=”MODULE_TYPE” />
<validation validateIntegratedModeConfiguration=”false” />
That will be all! Wasn’t that easy? Start using your bin deployed assembly in your website. Also note that .NET is full trust by default in our servers which will allow you to load any assembly that needs full trust as well from bin folder.