开发者

Changing some of COM "things" from external place

It's a hard question. We have an ASP.NET application, IIS7 server (running classic pipeline, if its relevant) and one fat ugly COM objects library.

The application uses this library this way: call a function, take result, show it.

The problem is: the COM library has no function to change language preference - it initializes it from the "web.config" file and then there is no obvious way to change it.

The problem is: how to do it non-trivial way. I can do anything with ASP.NET app and some stuff on server itself.

Basically, I thi开发者_开发问答nk, I need is to somehow call SetThreadCultureUI() for Application Pool thread. Also, there is, of course, chance that I can create few application domains for each language, and load COM in them, but it will be too much coding.

Soo.. Any ideas ho to do it the fastest and easiest way? (multiple App Pools with copies of one App is already a used solution, but a bad one)


You'll need to do some testing. If the COM application really is reading language settings from web.config (and frankly it would be rather unusual if it did) then there's not much you can do. Re-writing web.config is really hard, not least because you restart the application pool when the file is saved!

If, however, it's checking the OS for the culture for a given thread, you could use a BackgroundWorker in your code to spawn off a new thread. There, you can set the culture, and call your COM object (with appropriate locks in place to ensure thread-safety) without too much extra overhead.

Alternatively, yes, multiple app pools is a heavyweight but trivial answer to the problem. I think that's the only solution if the COM library does read web.config.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜