Loading remote assembly from the webservice in C#

This technique may be helpful for creating distributed applications or application that needs to be updateable through LAN or internet. What do you need to know:

  • What is a strong name
  • What is assembly
  • How to use the command line (cmd.exe)
  • How to use the CSC compiler
  • Hot to configure the application, What is the config file
  • What is IIS

Steps:

  • Create strong-named assembly

  • Compile it

  • Place at your server

  • Create a Solution that will use this assembly

  • Create a Config file for your solution with the following contents

    **How to:

    1. Create strong-named assembly**
      a. Generate the key (cmd command): sn -k key.snk
      b. Put the following lines in your assembly source code:
  using System;
  using System.Reflection;
  ....

  [assembly:AssemblyKeyFile(@"PATH\key.snk")]
  [assembly:AssemblyVersion("1.0.0.0")] 

  ....
  namespace My
  {

   
}
<?xml version="1.0" encoding="utf-8" ?>

<configuration>

 <runtime>

   <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">

     <dependentAssembly>

       <assemblyIdentity name="lib"

                         publicKeyToken="0adfbaad3776a0d3"

                         culture="neutral" />

       <codeBase version="1.0.0.0" href="http://localhost/asm/lib.dll"/>     

     </dependentAssembly>

   </assemblyBinding>

 </runtime>

</configuration>

Please do not post any spam link in the comment box😊

Post a Comment (0)
Previous Post Next Post