title: Loading Native Managed and C++ DLL within IIS 7 for WCF Project On Runtime
body: <p>I have WCF service developed in C# for with .NET framework 4.0 for IIS v7. My service <strong>using</strong> some managed VC++.NET DLL's which internally relies on some native C++ DLL's.</p>
  
  <p>Now I have following options to proceed;</p>
  
  <p>1) Publish all my managed DLL's in GAC (Global Repository)
  2) set PATH environment variable, re-start my machine so that IIS (7) server can pick up the changes.</p>
  
  <p>But client does not want both of the above solution because of following reasons;
  1) They do not want anything available globally
  2) Setting PATH, re-start the machine for every service deployed....NAAAAAH!!!! </p>
  
  <p>So I researched and then I found I can set the environment on runtime, so I added some  properties within my Web.config file and thought of appending my environment for each service on runtime. But the problem is that where should I write this peace of code as if I append this code in service class IIS will fail as it will try to resolve all the dependencies but fail as my code is not ran yet.</p>
  
  <p>Now I want, a way to split my code which set up the environment in separate class for each service on startup of the service and called that in the end when we un-deploy.</p>
  
  <p>I am not sure if it is even possible?</p>
  
  <p><strong>P.S Please bare in mind I am new to WCF and .NET stuff.</strong> </p>
  
  <p>Your help and comments will be appreciated.</p>
  
  <p>--</p>
  
  <p>SJunejo</p>