在ASP经典的Server.CreateObject和CreateObject区别 [英] difference between server.createObject and createobject in asp classic

查看:218
本文介绍了在ASP经典的Server.CreateObject和CreateObject区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

你应该使用的Server.CreateObject

you should use server.createObject

如果您已经熟悉VBScript或JScript,注意不要使用脚本语言的函数用于创建新的对象实例(在的CreateObject VBScript或新建在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内建的对象没有访问(如集合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 是pretty一样一样使用的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.

在MTS / COM +的行为,无论是的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经典的Server.CreateObject和CreateObject区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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