跟踪不工作在从VB6的EXE加载.NET的DLL [英] Trace not working in a .NET DLL loaded from VB6 EXE

查看:100
本文介绍了跟踪不工作在从VB6的EXE加载.NET的DLL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个.NET的DLL写入跟踪。但似乎当我打电话从VB6 EXE跟踪不工作我的DLL。 我创建与跟踪配置的EXE文件夹中的文件myApp.config,但是这并没有解决问题。

I have a .NET DLL that writes to the Trace. But it seems that when I call my DLL from a VB6 EXE the trace is not working. I have created an myApp.config file in the EXE folder with the trace configuration, but this does not solve the issue.

我也试着创造code跟踪的对象,但不工作:

I've also tried creating the Trace objects in code, but doesn't work:

Dim _traceSrc As TraceSource = New TraceSource("myTraceSorce")
Dim flListener As FileLogTraceListener = New FileLogTraceListener("myFileLogTraceListener")
Dim tSwitch As SourceSwitch = New SourceSwitch("mySwitch")
tSwitch.Level = _logLevel

如果我把我的DLL从.NET EXE它的作品,即使我没有在EXE文件夹中的app.config,因为我在code设置,如果没有找到该配置。

If I call my DLL from a .NET EXE it works, even if I dont have the app.config in the EXE folder, because I set it in code if the config is not found.

推荐答案

如果您的VB6应用程序叫做MyApp.exe的那么配置文件应该被称为 MyApp.exe.config 。 ( MyApp.config 不工作也有时取决于.NET框架版本和服务包。)

If your VB6 application is called MyApp.exe then the config file should be called MyApp.exe.config. (MyApp.config does also work sometimes depending upon .NET Framework versions and service packs.)

里面的配置文件的设置应该工作。

Inside that config file your settings should work.

我已经跟踪我的code通过COM这是工作的罚款从VB6运行。

I have tracing in my code running from VB6 via COM that is working fine.

另外有没有可能运行VB6 code,当你的权限是不同的?

Also is there any chance your privileges are different when running the VB6 code?

最后,如果你正在调试VB6应用程序在VB6 IDE需要将设置添加到 VB6.exe.config 在VB6.EXE文件夹,并重新启动VB6,确保变更的注意。

Finally, if you're debugging the VB6 app in the VB6 IDE you need to add the settings to the VB6.exe.config in the VB6.exe folder, and restart VB6 to ensure changes are noticed.

这篇关于跟踪不工作在从VB6的EXE加载.NET的DLL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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