asp中无法跨session,application调用vb组件的原因

 

IIS是一个线程服务器,每一个asp都是一个线程,因而跨session,application就必须满足这一点。遗憾的是,vb是一个面向高级应用的开发工具,并不支持跨线程的组件,只能编写单线程的组件。而猴版的vbs更是如此,在vbs中用class定义出来的对象一样不允许跨线程。

要突破这一点,就必须使用vc,cb之类低级的开发工具,而其中手工定义接口,IDispatch,IUnknown,UID之类的事,让人头昏脑涨,即便是vs.net 2005 , cb6中 ,也似乎没有多少改善。

下面引用cb的一段帮助来说明各种组件的不同

Automation Objects can have one of the following:

Single Only one client thread can be serviced at a time. COM serializes all incoming calls to enforce this. Your code needs no thread support.
Apartment Each object instantiated by a client is accessed by one thread at a time. You must protect against multiple threads accessing global memory, but objects can safely access their own instance data (object properties and members).
Free Each object instance may be called by multiple threads simultaneously. You must protect instance data as well as global memory.

Both This is the same as the Free-threaded model, except that all callbacks supplied by clients are guaranteed to execute in the same thread. This means you do not need protect values supplied as parameters to callback functions.
Neutral Multiple clients can call the object on different threads at the same time, but COM ensures that no two calls conflict. You must guard against thread conflicts involving global data and any instance data that is accessed by more than one method. This model should not be used with objects that have a user interface. This model is only available under COM+. Under COM, it is mapped to the Apartment model.

 

希也不要太深究此问题,C程序员和asp程序员的薪水差别之大是显而易见的,我想当真能够用c编写出需要的组件时,没人舍得回到廉价的asp工程上了。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值