
Note: The following syntax was written using Visual Studio 2010 you would need to change "%VS100COMNTOOLS%" to "%VS90COMNTOOLS%" for Visual Studio 2008 or "%VS110COMNTOOLS%" for Visual Studio 2012.įor /f "usebackq tokens=1,2* delims=," %%a in (`tasklist /fi "MODULES eq .*" /fi "IMAGENAME eq DLLHOST.EXE" /fo csv ^| find /i "dllhost.exe"`) do taskkill /f /pid %%b With that in mind, here are some example pre-build/post-build commands that will unregister/reregister your provider in the GAC, restart the FTP service, and terminate any orphaned FTP extensibility DLLHOST.EXE processes. With a little modification and some command-line wizardry, you can automate the termination of any orphaned DLLHOST.EXE processes that are being used for FTP extensibility. If you have read some of my earlier blog posts or walkthroughs on IIS.NET, you may have noticed that I generally like to use a few pre-build and post-build commands in my FTP projects usually I add these commands in order to to automatically register/unregister my FTP providers in the Global Assembly Cache (GAC).

However, if you are developing custom FTP providers and the DLLHOST.EXE process is not terminated by the FTP service, you may find yourself in a situation where you have a DLLHOST.EXE process in memory that contains an older copy of your provider, which will not be removed from memory until the DLLHOST.EXE process for FTP extensibility has been forcibly terminated. When you restart the FTP service, that should clean up the DLLHOST.EXE process that is being used for FTP extensibility. I'll bypass mentioning any other troubleshooting tasks and cut to the chase - if you read my Changing the Identity of the FTP 7 Extensibility Process blog post a year ago, you will recall that I mentioned that all custom FTP extensibility providers are executed through COM+ in a DLLHOST.exe process. You restart the FTP service as a troubleshooting step, but that does not appear to make any difference. Your provider appears to be working, it's just that any new functionality is not reflected in your provider's behavior.
#Dllhost exe code
Here are the details of the situation: let's say that you are developing a new FTP provider for IIS, and your code changes never seem to take effect.

With that in mind, I thought my situation would make a great blog subject because someone else may run into it. I was recently creating a new authentication provider using FTP extensibility, and I ran into a weird behavior that I had seen before.
