Delphi Intraweb 网站在 IIS 上崩溃
我制作了一个 Intraweb ISAPI 应用程序。构建 dll 后,我在 IIS 上创建了一个网站并为该应用程序创建了一个池。在 Inetpub 目录中,为 Internet Guest 帐户和 IIS_WPG 帐户设置权限。
当我尝试从 IE 访问网页时 (http://ip.0.0.1/ website/application.dll)它返回我 HTTP 500 或
错误。网上查了一下说是COM初始化的问题。但在应用程序的数据模块中有这样的代码:
initialization
CoInitialize(nil);
finalization
CoUninitialize;
有人能给任何建议吗?
I've made an Intraweb ISAPI application. After building the dll, I've created an Web site on IIS and a pool for the application. On the Inetpub directory the permissions are set for the Internet Guest Account and for the IIS_WPG accounts.
When I'm trying to access the webpage from IE (http://ip.0.0.1/website/application.dll) it returns me HTTP 500 or
errors. After searching on the Internet it says that is a problem of COM initialization. But in the datamodule of the application there is this code:
initialization
CoInitialize(nil);
finalization
CoUninitialize;
Can anybody give any advice?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不要使用您自己的 CoInitliaze 调用,而应使用 ServerController 并将 ComInitialization 属性设置为 ciMultiThread。
从我的 IntraWeb 课件手册中可以看出:“当应用程序需要使用 (D)COM 时,需要使用 TComInitialization 类型的 ComInitialization 属性(ciNone、ciNormal、ciMultiThread)。由于 IntraWeb 在不同的线程中执行请求,因此每个线程都必须调用自己的共同初始化。
默认情况下,此属性设置为 ciNone,表示不需要 COM 支持。如果您需要 COM 支持 - 例如,如果您想要连接到 DataSnap 服务器 - 那么您需要将 ComInitialization 设置为 ciNormal 或 ciMultiThreaded。
就我个人而言,我发现在 ISAPI DLL 中以一种或另一种方式使用 COM 时没有理由不将其设置为 ciMultiThreaded,尽管 IIS 6 及更高版本可能已经为您处理了所需的 ComInitialization,并且您应该将其设置为 ciNone (但看起来当设置为其他值时它会被忽略,因此 ciMultiThread 也不会造成伤害)。”
Do not use your own CoInitliaze calls, but instread use the ServerController and set the ComInitialization property to ciMultiThread for example.
From my IntraWeb Courseware manual: "The ComInitialization property of type TComInitialization (ciNone, ciNormal, ciMultiThread) is needed when the application requires the use of (D)COM. Since IntraWeb executes requests in different threads, each thread must make its own call to CoInitialize.
By default this property is set to ciNone, to indicate that no COM support is required. If you need COM support - for example if you want to connect to a DataSnap server - then you need to set ComInitialization to ciNormal or ciMultiThreaded.
Personally, I’ve found no reason not to set it to ciMultiThreaded when working with COM in one way or another inside an ISAPI DLL, although IIS 6 and higher may handle the required ComInitialization already for you, and you should set it to ciNone (but it looks like it’s ignored when set to some other value, so ciMultiThread won’t hurt either)."