Can't load a compiled dll first time

Discussion in 'ASP .Net Web Services' started by iunkwn, Apr 4, 2012.

  1. iunkwn

    iunkwn

    Joined:
    Apr 4, 2012
    Messages:
    1
    Hello Gurus, I have a WCF service that exposes a method. When a client calls this method, the following occurs:
    1) the method does some processing
    2) it tries to load an assembly if its already there
    3) if the above dll isn't there, it generates C# code, compiles it using CSharpCodeProvider's CompileAssemblyFromSource api
    4) It then loads the just generated assembly

    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.

    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.

    Any help would be much appreciated.
     
    iunkwn, Apr 4, 2012
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Pavils Jurjans
    Replies:
    0
    Views:
    377
    Pavils Jurjans
    Apr 1, 2004
  2. Ravi Ambros Wallau
    Replies:
    1
    Views:
    512
    =?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=
    Feb 14, 2006
  3. Klaus Schneider
    Replies:
    1
    Views:
    551
    Rolf Magnus
    Dec 2, 2004
  4. lander
    Replies:
    5
    Views:
    597
    bruce barker
    Mar 5, 2008
  5. Matt Adamson
    Replies:
    2
    Views:
    118
    Steve C. Orr [MCSD, MVP, CSM, ASP Insider]
    Mar 9, 2007
Loading...

Share This Page