它在哪里寻找 COM/WCF 配置文件?

发布于 2024-11-03 03:39:17 字数 326 浏览 0 评论 0原文

我有一个安排,用基于 WCF 的全新服务替换旧代码。

我有一个 dll (a.dll),它调用我要替换的 dll (b.dll)

b.dll 使用 WCF 调用来访问我的 IIS 托管 WCF 应用程序提供的功能 (c) 我正在使用手写代理b~c,以便一切都得到充分整理。

我遇到的问题是,当我运行使用 a.dll 的测试应用程序时,因此使用 b.dll 和 c,它抱怨找不到我的端点配置。

在这种情况下它在哪里寻找配置文件?我尝试创建 b.dll.config。

我讨厌硬编码,因为这是 WCF 的主要优点之一,它可以通过配置进行配置,因此无需重新编译。

I have an arrangement where I am replacing legacy code with a shiny new WCF based service.

I have a dll (a.dll) that calls a dll that I am replacing (b.dll)

b.dll uses a WCF call to access functionality provided by my IIS hosted WCF app (c) I am using a hand written proxy for b~c so that everything is adequately tidied up.

The problem I have is when I run my test app that uses a.dll and therefore b.dll and c it complains it can not find my endpoint config.

Where is it looking for the config file in this situation? I have tried creating a b.dll.config.

I am loathed to hard code as that is one of the key benefits of WCF it can be configured via config and hence no recompile.

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

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

发布评论

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

评论(3

呢古 2024-11-10 03:39:17

只有一个默认配置文件,句号。如果您正在运行app.exe,那么那就是app.exe.config。如果它是基于 Web 的应用程序,那么它就是 web.config 文件的层次结构。

这就是它寻找配置的地方。

There is only ever a single default config file, period. If you are running app.exe, then that is app.exe.config. If it's a web-based application, then it's the hierarchy of web.config files.

That's where it's looking for the configuration.

筑梦 2024-11-10 03:39:17

答案如下:--显然我在 8 小时内不允许回答我自己的问题--

大家好,

各位关注者。我最终按照其他人的建议确定了配置文件。

普罗克蒙。我添加了一个过滤器 include->path->.config

,从中我发现当我使用 VB6 ide “代码”运行 a.dll 时,它在

C:\Program Files\Microsoft Visual Studio\ 中查找VB98\VB6.exe.config

疯狂,我知道这个 dll 被称为我自己的 test.exe,而 test.exe.config 不起作用。

另外,它只在实例化 VB6.exe 时查找该文件,因此对其进行更改(显然我猜)需要回收...

我尝试了明显输出配置位置的代码,并使用此信息“抛出异常”。这些路都错了。

现在我只需要弄清楚当 a.dll 没有在代码中运行时它会在哪里......深感高兴!

更新:为了在 a.dll 未在代码中运行时完成,配置文件是 test.exe.config。

这已得到证实。

谢谢你们!

ANSWER FOLLOWS: --APPARENTLY I AM NOT ALLOWED TO ANSWER MY OWN QUESTION FOR 8hrs--

Hello right,

To all those that follow. I identified the config file in the end by following something that someone else suggested.

Procmon. I added a filter include->path->.config

and from this I found that as I was running a.dll 'in code' using the VB6 ide that it was looking in

C:\Program Files\Microsoft Visual Studio\VB98\VB6.exe.config

Crazy, I know as this dll was being called my own test.exe and test.exe.config did not work.

Also, it only looks for the file when VB6.exe is instantiated so changes to it (obviously I guess) require a recycle...

i tried code that apparently output the config location and 'threw an exception' with this information. These paths were all wrong.

Now I just need to figure out where it looks when a.dll is not being run in code.... deep joys!

UPDATE: For completion when the a.dll is not being run in code the config file is test.exe.config.

This is confirmed.

Thanks guys!

灼疼热情 2024-11-10 03:39:17

添加到其他解决方案:虽然当您在代码中运行它时它看起来很奇怪,但我发现我可以简单地制作 myapp.exe,将配置重命名为 myapp.exe.config,然后运行 ​​exe (即不在ide)并且它会找到它。

To add to the other solutions: while it is looking in weird places when you run it in code, I found that I could simply make myapp.exe, rename the config to myapp.exe.config, then run the exe (ie not in the ide) and it would find it.

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