IID and CLSCTX_INPROC_SERVER
Mark Hammond
mhammond at skippinet.com.au
Tue Jan 15 22:46:42 EST 2002
Steve Holden wrote:
> At present I'm using a COM object declared as an in-proc server. This
> appears to have the disadvantage that the IIS (4) process caches the
> object's class definition, so when I change the code there appears to be
> nothing I can do short of rebooting NT to force IIS to recognize the new
> definition.
This is not really IIS's fault, but the way Python handles modules. A
Python COM object is loaded from a standard Python module. So, what
win32com does is, basically:
import yourmodule
klass = yourmodule.YourClass()
The problem is that this is all done in the same runtime, so the import
statement will be cached for 2nd and subsequent imports. Even if IIS
attempts to unload the Python DLL, Python COM refuses and does not
unload (mainly due to perf issues).
> Can someone tell me a) whether it's possible to re-initialise with a new
> object definition without rebooting, and/or b) whether this situation will
> be alleviated if I move to using CLSCTX_LOCAL_SERVER?
>
> I'm not really quite clear enough on the details of COM object registration,
> creating and destruction to see my way through the woods here.
It should be possible to have your ASP code explicitly reload() the
module. Eg, you could simply execute some ASP code that does:
import yourmodule
reload(yourmodule)
# create the COM object used
Alternatively, consider using the "Python.Interpreter" COM object to
explicitly import and reload the module.
Mark.
More information about the Python-list
mailing list