从 aspx 页面访问 ACTIVEX DLL 中的资源

发布于 2024-10-30 22:36:11 字数 1319 浏览 0 评论 0原文

我有一个用 vb6 编写的 activeX dll。在该代码中,它使用 LoadResPicture() 加载图像,然后将其发送到打印机(使用 PaintPicture)

如果我使用托管的 ASPX 页面调用此 DLL在运行 IIS 7.0 的 Windows 2008 机器上,无法打印图像。

如果我在同一台服务器上使用 VBS 脚本调用此 DLL,则图像可以正常打印。

当 aspx 页面托管在 Windows 2000 Server 上时,该图像可以正常打印。

这是 VBS 代码:

Dim CheckCtl
set CheckCtl = CreateObject("CHECKCONTROL.CHECK")

CheckCtl.FBOAccountID = 2765
CheckCtl.includesignature = True
CheckCtl.Amount = 500.00
CheckCtl.CheckDate = #04/06/2011#
CheckCtl.Payee_L1 = "Donald Trump"
CheckCtl.Payee_L2 = "10 Park Place"
CheckCtl.Payee_L3 = "Atlantic City, NJ 00011"
CheckCtl.Payee_L4 = ""
CheckCtl.Notes = "This is a test check"
CheckCtl.SubmittedBy = "Accountant"

dim lSuccess
lSuccess = CheckCtl.Printcheck()

这是 ASPX VB.NET 代码:

Dim CheckCtl As checkcontrolNET.Check
CheckCtl = New checkcontrolNET.Check
CheckCtl.FBOAccountId = 2765
CheckCtl.IncludeSignature = True
CheckCtl.Amount = 500.0
CheckCtl.CheckDate = "04/06/2011"
CheckCtl.Payee_L1 = "Donald Trump"
CheckCtl.Payee_L2 = "10 Park Place"
CheckCtl.Payee_L3 = "Atlantic City, NJ 00011"
CheckCtl.Payee_L4 = ""
CheckCtl.notes = "This is a test check"
CheckCtl.SubmittedBy = "Accountant"

Dim lSuccess As Boolean
lSuccess = CheckCtl.printcheck()
Response.Write(lSuccess)

我缺少什么?

I have an activeX dll that was written in vb6. Inside that code it uses the LoadResPicture() to load an image that it then sends to a printer (using PaintPicture)

If I call this DLL using an ASPX page, that hosted on a Windows 2008 box running IIS 7.0, the image doesn't print.

If I call this DLL using a VBS script on the very same server, the image prints fine.

The image used to print fine when the aspx page was hosted on a Windows 2000 Server.

Here is the VBS Code:

Dim CheckCtl
set CheckCtl = CreateObject("CHECKCONTROL.CHECK")

CheckCtl.FBOAccountID = 2765
CheckCtl.includesignature = True
CheckCtl.Amount = 500.00
CheckCtl.CheckDate = #04/06/2011#
CheckCtl.Payee_L1 = "Donald Trump"
CheckCtl.Payee_L2 = "10 Park Place"
CheckCtl.Payee_L3 = "Atlantic City, NJ 00011"
CheckCtl.Payee_L4 = ""
CheckCtl.Notes = "This is a test check"
CheckCtl.SubmittedBy = "Accountant"

dim lSuccess
lSuccess = CheckCtl.Printcheck()

Here is the ASPX VB.NET Code:

Dim CheckCtl As checkcontrolNET.Check
CheckCtl = New checkcontrolNET.Check
CheckCtl.FBOAccountId = 2765
CheckCtl.IncludeSignature = True
CheckCtl.Amount = 500.0
CheckCtl.CheckDate = "04/06/2011"
CheckCtl.Payee_L1 = "Donald Trump"
CheckCtl.Payee_L2 = "10 Park Place"
CheckCtl.Payee_L3 = "Atlantic City, NJ 00011"
CheckCtl.Payee_L4 = ""
CheckCtl.notes = "This is a test check"
CheckCtl.SubmittedBy = "Accountant"

Dim lSuccess As Boolean
lSuccess = CheckCtl.printcheck()
Response.Write(lSuccess)

What am I missing?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

青春如此纠结 2024-11-06 22:36:11

您的服务器是 64 位的吗?根据 MSDN,该函数的 .Net 版本仅在 32 位版本上受支持,因此 VB6 版本可能也是如此。

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

Is your server 64-bit by any chance? According to MSDN, the .Net version of that function is only supported on 32-bit versions so its possible the same may be true for the VB6 version.

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

书信已泛黄 2024-11-06 22:36:11

我发现使用 IIS 来实现 VB ActiveX 的 COM+ 方法很奇怪。我希望您能够控制 VB6 Dlls 代码,如果是这样,请尝试将此代码放入您要实例化的 VB6 类中。

Private moScriptCtx As ScriptingContext

Public Sub OnStartPage(SC As ScriptingContext)

    Set moScriptCtx = SC

End Sub

您现在可以访问请求、响应、服务器等作为 moScriptCtx 对象的属性。在 CreateObject 执行期间,ASP 会自动为您调用 OnStartPage()

[编辑]

如果您不使用 ASP 的固有属性,这对于您的情况可能没有用,但请尝试在 COM+ 管理控制台上启用此功能。

Fire up the COM+ management consoleo    
Find the COM+ Application in questiono    
Find the applicable component in the 'Components' folder
Right click on it and choose properties
Select the Advanced tab
Check the 'Allow IIS Intrinsic Properties' checkbox

http://blogs.msdn.com/b/distributedservices/archive/2010/04/28/iis-intrinsic-properties-are-disabled-by-default-on -windows-2008-and-windows-2008-r2.aspx

I found COM+ approach for VB ActiveX with IIS wacky. I hope you have control over VB6 Dlls code and if so, try putting this code into the VB6 class you are trying to instantiate.

Private moScriptCtx As ScriptingContext

Public Sub OnStartPage(SC As ScriptingContext)

    Set moScriptCtx = SC

End Sub

You can now access Request,Response,Server etc as properties of the moScriptCtx object. ASP automagically calls OnStartPage() for you during the CreateObject execution.

[EDIT]

This may not be useful in your case if you are not useing ASP's intrinsic properties, but try enabling this on COM+ management console.

Fire up the COM+ management consoleo    
Find the COM+ Application in questiono    
Find the applicable component in the 'Components' folder
Right click on it and choose properties
Select the Advanced tab
Check the 'Allow IIS Intrinsic Properties' checkbox

http://blogs.msdn.com/b/distributedservices/archive/2010/04/28/iis-intrinsic-properties-are-disabled-by-default-on-windows-2008-and-windows-2008-r2.aspx

坚持沉默 2024-11-06 22:36:11

这听起来很像权限问题。我怀疑您的 Windows 2000 服务器在 SYSTEM 帐户下运行 IIS,并且可能对旧的 ASPNET 工作进程帐户执行相同的操作。

检查运行站点的帐户是否具有打印权限。根据您保护站点的方式,这可能是以下任意一种:

  • 应用程序池标识
  • 特定的匿名帐户
  • IUSR 帐户

This sounds suspiciously like a permissions problem. I suspect that your Windows 2000 server ran IIS under the SYSTEM account and probably did the same with the old ASPNET worker process account.

Check that the account that the site runs under has permissions to print. Depending on how you've secured the site this could be any one of:

  • The application pool identity
  • A specific anonymous account
  • The IUSR account
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文