title: Issue with CompileAssemblyFromSource when called from a WCF app
body: <p>I have a WCF service that exposes a method. When a client calls this method, the following occurs:</p>
  
  <ol>
  <li>the method does some processing</li>
  <li>it tries to load an assembly if its already there</li>
  <li>if the above dll isn't there, it generates C# code, compiles it using CSharpCodeProvider's CompileAssemblyFromSource api</li>
  <li>It then loads the just generated assembly</li>
  </ol>
  
  <p>Now the problem. The first time the method it called, it generates the assembly at point 3), and when it tries to return the assembly reference via CompilerResults.CompiledAssembly it throws a file not found exception. However, I can clearly see that the assembly has been generated at the specified location and I can open it with other applications.</p>
  
  <p>If I call the method again via a client, it is able to load the assembly (it was successfully generated as a result of the previous call) and goes ahead to do the remaining set of tasks. Only when the assembly isnt there and it generates it and goes ahead to load it immediately, I get that exception. Any ideas? I have tried playing around with the web.config, changing impersonation to true/false. I have a seperate app pool to run this web application and I tried changing the identity of the app pool from local service to local system, even gave my windows logon credentials which has admin rights but no luck.</p>
  
  <p>Any help would be much appreciated. </p>