在asp Classic中server.createObject和createobject之间的区别 [英] difference between server.createObject and createobject in asp classic

查看:367
本文介绍了在asp Classic中server.createObject和createobject之间的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

http://msdn.microsoft.com/en-us/library/ms524620.aspx

您应该使用server.createObject

you should use server.createObject


如果您已经熟悉VBScript或JScript,请注意,不要使用脚本语言的函数创建新的对象实例(CreateObject in VBScript或New在JScript中)。您必须使用ASP Server.CreateObject方法;否则,ASP无法跟踪您在脚本中对对象的使用。

If you are already familiar with VBScript or JScript, note that you do not use the scripting language's function for creating a new object instance (CreateObject in VBScript or New in JScript). You must use the ASP Server.CreateObject method; otherwise, ASP cannot track your use of the object in your scripts.

但一些其他人认为server.createObject意味着开销大多数时候都可以避免。

but some other folks think that server.createObject implies an overhead that most times could be avoided

http://classicasp.aspfaq.com/components/should-i-use-createobject-or-server-createobject.html


CreateObject具有比Server.CreateObject少的开销,因为后者使用MTS - 导致显着的开销。


当组件遇到错误时,您也将遭遇性能命中,因为使用Server.CreateObject,这些错误被写入事件日志(无可否认,在调试期间这是有用的)。

CreateObject has less overhead than Server.CreateObject, because the latter uses MTS — causing significant overhead.

You will also suffer performance hits when the component encounters errors, because with Server.CreateObject, these errors are written to the event log (which, admittedly, can be useful during debugging).

http://www.4guysfromrolla.com/webtech/043099-1.shtml


如果你正在编写一个处理事务的组件,这可能会变得很重要,因为它将是一个很好的安全网,通过MTS,因为你将使用MTS命令。但是,如果您不使用MTS,您可以通过传递Server.CreateObject来创建处理器和内存。这使它更好地使用CreateObject,因为它直接通过。

This can become significant if you are writing a component that deals with transactions, as it would be a good safety net to pass it through MTS, because you will be using MTS commands. However, if you are not using MTS, you could create processor and memory over head by passing it through Server.CreateObject. This makes it a better idea to use CreateObject, because it goes straight through.

所以如果我不使用mts,访问内置的asp的对象(像set d = createObject(scripting.dictionary))是确定只是忘记了server.createObject并使用createobject)

so if I'm not using mts and need no access to the builtins asp's objects (like set d = createObject("scripting.dictionary") ) is it ok to just forget about the server.createObject and go with createobject ) ???

感谢很多...

推荐答案

您引用的文章有些过时。因为IIS 5和COM +在Windows 2000及以上使用直接 CreateObject 与使用 Server.CreateObject

Those articles you are quoting are somewhat out-of-date. Since IIS 5 and COM+ on Windows 2000 and above using the straight CreateObject is pretty much the same as using Server.CreateObject.

CreateObject Server.CreateObject 现在是一样的,这部分是由于ASP本身作为COM +应用程序运行的事实。您可以指定ASP页面启动事务,然后使用 CreateObject 任何实现IObjectContext的对象将被邀请加入事务等。

The MTS/COM+ behaviour of either CreateObject or Server.CreateObject is now the same, this in part due to the fact that ASP itself runs as a COM+ application. You can specify that the ASP page starts a transaction and then using CreateObject any object implementing IObjectContext will be invited to join the transaction etc.

我知道的唯一真正的区别是一个遗留的事情,其中​​正在创建的COM对象可能有OnStartPage和OnEndPage方法。使用 Server.CreateObject 在创建对象时以及在对象释放之前调用这些方法。这不会发生在 CreateObject

The only real difference I know of is a legacy thing where a COM object being created may have OnStartPage and a OnEndPage method. Using Server.CreateObject these methods are called when the object is created and just before the object is released. This doesn't happen with CreateObject.

这篇关于在asp Classic中server.createObject和createobject之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆