views:

102

answers:

1

I have a process in which a user uploads a file to a web site where the file is then processed and uploaded into the database. The process of validating the file could take several minutes so as soon as the file is uploaded I create a new thread and I do my processing on this second thread. This works great on my local machine but doesn't work at all on my IIS 7 test server.

After some investigating I found the problem is that the process is trying to load a reference to Castle and it can't find the DLL. I have a copy of Castle DLLs in my bin and it works elsewhere in my app. I ran Fuslog and discovered that it is trying to load castle from the wrong location. It is trying to load from c:/windows/system32/inetsrv/.

It appears that under IIS 7 the second thread is executing in a different context or something.

So the question is what can I do to get it to find Castle in the application BIN folder?

A: 

I am not very familiar with IIS but my guess is that for some reason the working directory has changed. One possibility is to change the working directory back to the bin folder. Another possibility is to subscribe to the AppDomain.AssemblyResolve event which will be invoked any tine the CLR fails to load an assembly - inside the event handler you can load the assembly from the dll and return it.

Itay
You are correct. It looks like IIS 7 may handle threading differently than IIS 6 and that threads are executed outside the web applications process. I'm going to try and run the app in IIS 7 classic mode and see if that fixes my issues.
DanielC