如何在 Windows 7 64 位上调试 VB6 IIS 应用程序
我需要能够在 Windows 7 64 位上调试 Visual Basic 6 IIS 应用程序。不仅仅是为了解决单一问题,而是为了持续发展。
尝试调试会导致 WebClass 运行时出现错误“发生了未指定的错误”。
如果我不进行调试而只是访问编译后的 webclass,则页面加载得很好。因此,我不认为应用程序的注册/配置有任何问题,而是与 Windows 操作系统安全性阻止 VB6 IDE 连接到 IIS 并允许其调试有关。
以下是我尝试过的所有操作:
- 禁用用户帐户控制(UAC)并重新启动。
- 修改了机器调试管理器 (MDM) 的 DCOM 组件安全性并分配了“每个人”启动和激活权限。
- 手动添加了“70F214BA-94E2-4bdf-8F30-32CB4A905E4D”的 DCOM 条目,这是 VB6 IDE,并分配了“Everyone”启动和激活权限。
- 禁用 Windows 防火墙
- 在 Windows XP SP3 的兼容模式下以管理员身份运行选项运行应用程序 (VB6.exe)。
- 创建了一个新的 IIS 应用程序池,并将身份设置为管理员帐户。将应用程序管道模式设置为经典并启用 32 位旧应用程序支持。
这耗尽了我丰富的经验去尝试。如果我创建 VB6 Windows 应用程序或 ActiveX 控件,我可以轻松启动和调试。
我在 Windows Server 2003 上遇到了非常类似的问题,尽管全新安装的 W2K3 解决了该问题。
在 Windows 系统事件查看器日志中,事件 ID 10004 有 2 个重复条目,如下所示:
DCOM 出现错误“1326”,无法登录 DOMAIN\User 来运行服务器: {70F214BA-94E2-4BDF-8F30-32CB4A905E4D}
其中 DOMAIN\User 是我的域帐户,上面提到的 GUID 是我为 VB ASP 调试添加的 DCOM 条目。
我必须提供的唯一额外信息是 Windows 7 64 位正在虚拟机中运行,尽管我在尝试调试时远程连接到控制台。我在没有控制台连接的虚拟机上调试时遇到了问题。
如果有人可以提供任何进一步的尝试建议,我将不胜感激。
如果有人能弄清楚这一点并在 Windows 7 操作系统上成功调试 IIS Web 应用程序并描述必要的设置,我将提供 300 点的当前赏金!
I have a need to be able to debug a Visual Basic 6 IIS Application on Windows 7 64-bit. Not just for a single problem but for continuing development.
An attempt to debug results in an error "An unspecified error has occurred" from the WebClass runtime.
If I do not debug and simply access the compiled webclass the page loads just fine. Therefore, I don't believe there is anything wrong with the registration / configuration of the application but rather this is somehow related to Windows OS security blocking the VB6 IDE from hooking into IIS and allowing it to debug.
Here are all of the things that I have tried:
- Disabled User Account Control (UAC) and rebooted.
- Modified DCOM component security for machine debug manager (MDM) and assigned "Everyone" launch and activate permissions.
- Manually added DCOM entry for "70F214BA-94E2-4bdf-8F30-32CB4A905E4D" which is the VB6 IDE and assigned "Everyone" launch and activate permissions.
- Disabled Windows Firewall
- Ran the application (VB6.exe) in compatibility mode of Windows XP SP3 with run as administrator option.
- Created a new IIS application pool with an identity set to an administrator account. Set the application pipeline mode to classic and enabled 32-bit legacy application support.
This exhausted my extensive experience of things to try. If I create a VB6 Windows Application or ActiveX control I can easily launch and debug.
I've experienced a very similar problem on Windows Server 2003 although a fresh install of W2K3 resolved the problem.
In the Windows System event viewer log there are 2 duplicate entries for Event ID 10004 as follows:
DCOM got error "1326" and was unable to logon DOMAIN\User in order to run the server:
{70F214BA-94E2-4BDF-8F30-32CB4A905E4D}
Where DOMAIN\User is my domain account and the GUID mentioned above is the DCOM entry I added for VB ASP Debugging.
The only extra information I have to offer is that Windows 7 64-bit is running in a VM although I am remoted to the console while attempting to debug. I've experienced problems debugging on VMs without a console connection.
If anyone can offer any further suggestions of things to try I would greatly appreciate it.
If anyone can figure this out and succesfully debug an IIS web application on a Windows 7 OS depicting the necessary settings I will offer the current bounty of 300 points!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(9)
我最近在我的 Windows 7 64 位机器上遇到了同样的问题。对我有用的解决方案是检查 Windows 事件日志(系统)中是否有特定的 DCOM 错误。这是我遇到的错误:
对我来说,关键点是授予 IUSR 内置帐户启动和激活权限。在尝试向该用户授予对各个 DCOM 组件的权限但失败后,我决定将该用户添加到计算机的默认 DCOM 权限中。您可以按如下方式执行此操作:
运行 dcomcnfg。右键单击“控制台根目录/组件服务/计算机/我的电脑”节点。选择属性。选择“COM 安全”选项卡。单击“访问权限”组下的“编辑默认值”。单击“添加”。输入事件日志中指示的用户(我的是 IUSR)。单击“确定”。对“启动和激活权限”组重复此操作。在所有对话框中选择“确定”。
我无需重新启动计算机即可使这些设置生效。我使用与在 XP 上使用的相同方法来调试 VB6 dll,即在 VB6 下运行 dll(无人值守执行),设置断点,导航到访问该 dll 的页面,然后等待断点被命中。希望这有帮助。
I recently experienced the same problem on my Windows 7 64 bit machine. The solution that worked for me was to check the windows event log (system) for the specific DCOM error. This is the error that I had:
The key point for me was to give the IUSR built-in account Launch and Activation permission. After attemtpting to give this user permission to the individual DCOM components and failing, I decided to add the user to the default DCOM permissions for the machine. You can do this as follows:
Run dcomcnfg. Right click on the Console Root/Component Services/Computers/My Computer node. Select Properties. Select the 'COM Security' tab. Click the 'Edit Default' under the 'Access Permissions' group. Click 'Add'. Enter the User indicated in your event log (mine was IUSR). Click OK. Repeat for the 'Launch and Activation Permissions' group. Select OK on all the dialogs.
I did not have to reboot my machine for these setting to take effect. I used the same method to debug the VB6 dll that I used on XP i.e. run the dll under VB6 (unattended execution), set a break point, navigate to a page that accessed the dll, and wait for the breakpoint to be hit. Hope this helps.
不知道这是否对您有进一步帮助。我正在研究我自己使用的同一问题。
在偶数查看器中我看到:
计算机默认权限设置不会向来自地址 LocalHost(使用 LRPC)的用户 NT AUTHORITY\IUSR SID (S-1-5-17) 授予 COM 服务器应用程序的本地激活
权限
。可以使用组件服务管理工具修改此安全权限。
..所以我尝试向“每个人”授予本地激活 - 只是看看我是否可以让它消失。 -我不能。
然后我在组件服务/我的计算机(属性)COM 安全、启动和激活权限中默认授予本地激活权限
,我仍然无法调试,但我不再在事件查看器中收到错误。在浏览器中,我得到
The call to
Server.CreateObject
failed while 检查权限。对此对象的访问被拒绝。上面的 CLSID 是我的 vb6 应用程序,但注册表指向 vb6debug.dll(看起来正确)。 progID 匹配等。
授予每个人对 vb6debug.dll 和其他文件的权限。
下一步是 procmon 或类似的东西来看看会发生什么。
Don't know if this helps you further.. I am researching the same issue my own use.
In even viewer I see:
The machine-default permission settings do not grant Local Activation permission for the COM Server application with
and
to the user NT AUTHORITY\IUSR SID (S-1-5-17) from address LocalHost (Using LRPC). This security permission can be modified using the Component Services administrative tool.
..so I attempt to grant Local Activation to "Everyone" - Just to see if I can make it go away. -I Can't.
Then I grant Local Activation as a default in Component services / my Computer (properties) COM Security, Launch and activation permissions
I still can't debug, but I no longer get errors in event viewer. In browser I get
The call to
Server.CreateObject
failed while checking permissions. Access is denied to this object.The CLSID above is my vb6 app, but registry points to vb6debug.dll (which looks right). progID match etc.
Granted permissions to everyone on the vb6debug.dll and other files.
Next step is procmon or something like that to see what happens.
我相信在任何比 Windows XP 更新的 Windows 版本上,都不可能在 IDE 中调试 VB6
IIS 应用程序
(可能情况与 Windows 服务器风格类似)。该问题的根本原因似乎是 IIS 6 和 IIS 7+ 之间的主要差异。当然,没有关于该主题的官方文档,因此我将在下面详细介绍。首先,回顾一下这个问题是有意义的。许多好人似乎忘记了
IIS Application
是一个准确的术语,指的是在此上下文中特殊类型的 VB6 项目。我能够在 Win7 Ultimate x64 SP1、Win7 Ultimate x86 SP1 和 Vista Enterprise x86 SP2 上按照以下步骤重现错误:IIS 应用程序
项目:紧接着,VB6 IDE 中出现错误消息:
让我们检查一下在 Windows XP 上执行相同场景时会发生什么。当开始调试 VB6
IIS 应用程序
时:所有这些都发生在 Windows XP 上在
WebClass
被激活之前。在 Windows 7 上,进程不会到达此阶段。很明显,VB6 IDE 尝试在 IIS 中执行一些管理任务,以便能够调试
WebClass
。人们可以借助进程监视器和API 监视器。很明显,VB6.exe 依赖于 IIS Admin Service 的 COM 接口。坏消息是,与以前的版本不同,IIS 7+ 不使用元数据库,并且 IIS 7+ 中没有 IIS 管理服务。人们可以安装 IIS Metabase 和 IIS6 兼容性组件,理论上,该组件应该使使用 Metabase 的应用程序能够继续使用 IIS 7+:不幸的是,安装它并不能解决问题。
有人建议您的问题可能是由于 COM 组件的启动和激活权限不足引起的。恐怕所有这些建议都是徒劳的。此类错误始终伴随着系统事件日志中的相关错误事件。本案中不存在此类事件。
I believe it is not possible to debug a VB6
IIS Application
in IDE on any version of Windows newer than Windows XP (probably, situation is similar for server flavor of Windows). The root cause of the problem seems to be major differences between IIS 6 and IIS 7+. Of course, there is no official documentation on the topic, thus I shall go into more details below.First, it makes sense to recap the problem. Many good folks seem to forget that
IIS Application
is an exact term referring to special type of VB6 project in this context. I was able to reproduce the error following these steps on Win7 Ultimate x64 SP1, Win7 Ultimate x86 SP1, and Vista Enterprise x86 SP2:IIS Application
project:Immediately after that there is error message in VB6 IDE:
Let us examine what happens when the same scenario is executed on Windows XP. When one starts debugging VB6
IIS Application
:All this happen on Windows XP before
WebClass
is activated. Process doesn't get to this stage on Windows 7.It is clear that VB6 IDE attempts to perform some administrative tasks in IIS in order to be able to debug a
WebClass
. One can delve a bit deeper with help of Process Monitor and API Monitor. It is clear then that VB6.exe relies on COM interfaces of IIS Admin Service. Bad news is that IIS 7+, unlike previous versions, doesn't use Metabase and there is no IIS Admin Service in IIS 7+. One can installIIS Metabase and IIS6 compatibility
component that, in theory, should enable applications that use Metabase to continue working with IIS 7+:Unfortunately, installing it doesn't resolve the problem.
There are suggestions that your problem can be caused by inadequate launch and activation permissions for COM components. I am afraid that all those suggestions are futile. Errors of that kind are always accompanied by related error events in System event log. There are no such events in this case.
您是否考虑过编写日志文件?它非常简单,您可以从代码最有可能导致错误的地方开始。我建议创建一个函数,它接受一些参数,例如子/函数名称、Err 对象和可选的额外字符串,以便您可以包含其他信息,例如代码所处的步骤。在错误处理程序中调用您的函数传递你的参数。
Have you considered writing a log file? It's pretty straight forward and you can begin just where the code is most likely to cause an error. I suggest creating a function that takes a few parameters such as a Sub/Function name, an Err object, and an optional extra string so you can include additional information such as what step your code was in. In your error handler call your function passing your parameters.
伙计,我可以同情一下吗?我花了将近 3 个工作日的时间,仍然没有找到一个令我非常满意的解决方案,但它确实有效,所以我“放弃”寻找正确的解决方案,并选择了这个,因为我不能再浪费资源时间了。
在IIS管理器下,点击虚拟目录->身份验证
- 禁用匿名身份验证
- 启用基本身份验证
浏览到应用程序,输入具有足够权限的域或工作站凭据,以使应用程序根据应用程序所在文件系统安全性的设置运行。
这实际上意味着每次第一次开始调试时我都必须向 virtdir 验证自己的身份,但最终再次启用调试功能只是付出了很小的代价。
Man, can I sympathize. I spent almost 3 man-days on this, and still don't have a solution that I'm incredibly happy with, but it does work, so I've "given up" finding the correct solution, and went with this, because I just can't waste any more resource time.
Under IIS Manager, click on virtual directory -> Authentication
- disable anonymous authentication
- enable basic authentication
Browse to app, enter domain or workstation credentials with enough privilege to make the app work based on what is set for the filesystem security where the app lives.
This effectively means that I have to authenticate myself to the virtdir every time I start debugging for the first time, but it's a small price to pay to finally have debugging functional again.
您能否将发送的信息复制到应用程序的 VB6 部分并从控制台进行测试?
我的意思是,这很恶心,但我们正在讨论调试混合 IIS VB6 应用程序。
Could you copy the information sent into the VB6 part of the application and test that from the console?
I mean, that's gross, but we are talking about debugging a hybrid IIS VB6 application.
我想你可以非常确定这不是微软不希望它工作的问题,而是它无法工作的问题。您知道此文档吗?: http://msdn.microsoft.com/en -us/vstudio/ms788708.aspx
它指出:
我也尝试过,但失败了,所以选择在虚拟机中运行 32 位操作系统,然后它就可以完美运行。我认为这是由于调试器如何挂钩到内核才能运行调试器。
I think you can be pretty sure it's not an issue that Microsoft doesn't want it to work, but simply that it can't work. Are you aware of this document?: http://msdn.microsoft.com/en-us/vstudio/ms788708.aspx
It states:
I've tried as well and failed so opted to run a 32-bit OS in a VM and then it works flawlessly. I think it's due to how the debugger hooks into the kernel to be able to run the debugger.
我今天2012年9月14日遇到了这个问题,并设法以最简单的方式解决它,我有调试dll我需要带有XP的Visual Basic 6.0我没有问题,但我将其更改为Windows 7并且iis7有问题,我在很多论坛和博客上读过,但我什么也没有,即使我做了这个博客,也没有,最后我解决了问题如下:组件服务->计算机->右键属性->然后单击安全选项卡COM->启动和激活权限部分->编辑默认值->然后添加本地服务帐户并授予所有权限。我澄清一下,对我来说,它可以在本地调试 Visual Basic 6.0 中的 dll,但如果它是好的或唯一的解决方案,则不是,我认为我做得很好,这应该根据他们在其他论坛上所说的内容来完成,现在很好Microsoft http://support.microsoft.com/kb/899965/es 页面显示同样的事情,但说添加网络服务帐户,就像我所做的那样,我为我命令事件查看器的错误所做的工作是:
“在计算机上默认设置的权限设置不会向具有 CLSID 的 COM 服务器应用程序授予本地激活权限{95D14525-F934-4D4F-9B33-2CE753FAF3B0} 和 APPID {95D14525-F934-4D4F-9B33-2CE753FAF3B0} 地址 LocalHost 中具有 SID (S-1-5-19) 的用户 NT AUTHORITY \ LOCAL SERVICE(使用 LRPC)。
可以使用组件服务管理工具修改此安全权限“
您会看到 NT \ AUTHORITY \ NETWORK SERVICE LOCAL SERVICE 帐户骨干。
仅此而已。
I had this problem today September 14, 2012 and managed to solve it in the simplest way possible, I have debug dlls I need visual basic 6.0 with XP I had no problem but I changed it to windows 7 and there was the problem with iis7, I read in many forums and blogs but nothing I was, even I did this blog, nor, in the end I fixed the problem as follows: Component Services-> Computers-> right Click Properties-> then click the Security tab COM-> section Launch and Activation permissions-> Edit Default -> and then add the Local Service account and gave all permissions. I clarify, for me it worked to debug the dll in visual basic 6.0 locally, but not if it is good or the only solution, I think I did well this should be done over what they say on the other forums , is now well on Microsoft http://support.microsoft.com/kb/899965/es page says the same thing but said that adding the NETWORK SERVICE account as I did and I worked for the mistake that I commanded the event Viewer is:
"Setting permissions set by default on your computer does not grant Local Activation permission to the COM Server application with CLSID {95D14525-F934-4D4F-9B33-2CE753FAF3B0} and APPID {95D14525-F934-4D4F-9B33-2CE753FAF3B0} the user NT AUTHORITY \ LOCAL SERVICE with SID (S-1-5-19) in the address LocalHost (with LRPC).
This security permission can be modified using the Component Services administrative tool "
You see says NT \ AUTHORITY \ NETWORK SERVICE LOCAL SERVICE account bone.
Well that's all.
听起来您希望在创建应用程序实例时在调试器中触发 VB6 IDE,但这是失败的。您是否尝试过在调试模式下启动 VB6 IDE 来托管 COM 组件,在源代码中设置断点,然后查看访问使用该组件的页面是否会导致调试器中的断点被命中?也就是说,将 VB6 IDE 的激活从循环中取出 - 让它运行应该只会导致应用程序的 CLSID 指向 IDE 的运行时实例作为 COM 主机。
自从我在 VB6 中进行开发以来已经很长时间了,所以一些细节可能是粗略的,但我确实记得调试 COM 服务器需要一些体操,解决方案之一是运行一个单独的 VB 实例作为 COM 输出 -进程外服务器主机。
It sounds like you want the VB6 IDE to fire in the debugger when the app instance is created, and that's failing. Have you tried starting the VB6 IDE in debug mode to host your COM component, set a breakpoint within your source, and then see if accessing the page that uses the component will then cause the breakpoint in the debugger to be hit? That is, take the activation of the VB6 IDE out of the loop - having it running should just cause the CLSID for the app to point to the runtime instance of the IDE as the COM host.
Been a long time since I did dev in VB6, so some of the details may be sketchy, but I do remember that debugging COM servers took some gymnastics, and among one of the solutions was running a separate instance of VB as the COM out-of-process server host.