How Do I Bin Deploy An ASP/.NET Assembly on Cloud Sites?
On the ASP.NET platform, it's not uncommon to use a third-party assembly to make features accessible from your code that you find useful, but that may not be available from the .NET framework. To do this, you deploy the module in the Bin directory, which is the reserved location in your application directory for assemblies; following this, you would update your Web.config to load this module for use on your website. This is commonly known as bin deploying an assembly or binary deployment.
Please follow the guide below to learn how to bin deploy a module for use.
- An existing Cloud Site (or follow this guide on Adding a new website)
- IIS/ASP.NET should be the default technology on this site or at a minimum should be enabled on this site
- The Rackspace Cloud uses a modified medium trust configuration. In order to properly function, the assembly must allow partially trusted callers. If you are not sure if the assembly will work in medium trust, please contact the vendor.
- After confirming the assembly will work in medium trust, you may continue to Getting Started.
- If you have a list of requirements for the assembly, please contact support to confirm if the requirements are met.
- Unfortunately any assembly requiring full trust is unsupported at this time.
To get started, you first have to obtain the assembly you want to bin deploy. In this example we'll bin deploy UrlRewriter.NET, a URL rewriter for ASP.NET applications that do not have the URL Rewrite Module installed.
- Visit http://www.urlrewriter.net/ and click the Download link on the top menu:
- Click the link to download the binaries and source code:
- Select one of the binary files, which will typically be the first link under the Newest Files. The most recent binary at the time of this article was UrlRewriterNet-1_8.zip:
- Your download should start within a few seconds; otherwise click the direct link:
- Save the file to a known location on your PC:
- Extract the Intelligencia.UrlRewriter.dll:
Uploading the Assembly
To make use of the assembly from your website code, the module must be located in the Bin directory on your FTP, which is the standard location for bin deploying assemblies. Following the example above, to bin deploy Intelligencia.UrlRewriter.dll you should connect to your website's FTP server and upload the DLL to this directory:
...where www.example.com is your website name.
Loading the Assembly in the Web.config
Some assemblies require different definitions in the Web.config to work properly; the best way to learn how to load an assembly is to consult the vendor's website. In this instance we are bin deploying Intelligencia.UrlRewriter.dll, so we consulted their website and found this help document explaining the configuration. Using this information, you could load the UrlRewriter.NET module using the following example Web.config:
<?xml version="1.0" encoding="UTF-8"?> <configuration> <configSections> <section name="rewriter" requirePermission="false" type="Intelligencia.UrlRewriter.Configuration.RewriterConfigurationSectionHandler, Intelligencia.UrlRewriter" /> </configSections> <system.web> <httpModules> <add name="UrlRewriter" type="Intelligencia.UrlRewriter.RewriterHttpModule, Intelligencia.UrlRewriter" /> </httpModules> </system.web> <system.webServer> <modules runAllManagedModulesForAllRequests="true"> <add name="UrlRewriter" type="Intelligencia.UrlRewriter.RewriterHttpModule" /> </modules> <validation validateIntegratedModeConfiguration="false" /> </system.webServer> </configuration>
Using the Assembly
Due to the vast amount of assemblies that can be bin deployed, it's impossible to cover usage of them in this simple article. As with loading the assembly, the best way to learn how to use an assembly is to consult the vendor's website. To learn how to use the Intelligencia.UrlRewriter.dll used in this example, please see this article on URL rewriting in ASP/.NET.
© 2015 Rackspace US, Inc.
Except where otherwise noted, content on this site is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License
See license specifics and DISCLAIMER