NServiceBus:不使用通用主机的非 XML 配置时抛出异常

发布于 2024-10-04 22:10:08 字数 296 浏览 0 评论 0原文

我想使用 NServiceBus 通用主机将我的订阅者作为服务运行。我的订阅者使用非 XML 配置,因此不需要 app.config。我的问题是,由于我没有 app.config,因此我从通用主机收到此错误:

在以下位置找不到配置文件:C:\My Dev\NServiceBus2.0.0.1145\samples\PubSub\Subscriber2\bin\Debug\Subscriber2.dll.config

有没有办法禁用通用主机的默认行为而不搜索 .config 文件?

I want to use the NServiceBus Generic Host for running my subscriber as a service. My subscriber uses no-XML configuration, so there is no need for an app.config. My problem is that since I don't have an app.config, I get this error from the Generic host:

No configuration file found at: C:\My
Dev\NServiceBus2.0.0.1145\samples\PubSub\Subscriber2\bin\Debug\Subscriber2.dll.config

Is there a way to disable to default behavior of the Generic host to NOT search for the .config file?

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

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

发布评论

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

评论(1

意犹 2024-10-11 22:10:08

看起来除了自己托管 NSB(来自主机源)之外没有其他办法解决这个问题:

            string endpointConfigurationFile = GetEndpointConfigurationFile(endpointConfigurationType);

            if (!File.Exists(endpointConfigurationFile))
            {
                throw new InvalidOperationException("No configuration file found at: " + endpointConfigurationFile);
            }

Looks like there is no way around this except to host NSB on your own(from the host source):

            string endpointConfigurationFile = GetEndpointConfigurationFile(endpointConfigurationType);

            if (!File.Exists(endpointConfigurationFile))
            {
                throw new InvalidOperationException("No configuration file found at: " + endpointConfigurationFile);
            }
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文