如何调试像 CodeCampServer 这样基于依赖注入的代码?
我的项目结构类似于CodeCampServer结构等UI.dll,Core.dll和DependencyResolution.dll,它们都依赖于UI.dll和core.dll。
在 web.config 中,我使用 DependencyResolution.dll 中的 HttpModule 来实例化所有依赖项,因此我无法在 VS2008 中运行此应用程序,因为 UI.dll 没有对 DependencyResolution.dll 的引用(我可以不要引用它,因为正如我已经说过的,DependencyResolution.dll 已经引用了 UI.dll),因此我失去了以常规方式单步执行代码来调试该应用程序的机会。
我想也许我可以尝试使用附加到进程功能,并在本地主机 IIS(Windows 7 计算机上的版本 7)上调试应用程序,但不幸的是它没有按预期工作。当发生错误时,VS不会突出显示代码,我也无法介入它。
我的问题是调试此类应用程序的最佳方法是什么(CodeCampServer 就是一个很好的例子)。
My project structure is like CodeCampServer structure, etc. UI.dll, Core.dll and DependencyResolution.dll that have a dependecy of both of UI.dll and core.dll.
In the web.config I use a HttpModules from the DependencyResolution.dll, to instantiate all the dependencies, and therefore I can't run this application in VS2008 because the UI.dll don't have a reference to DependencyResolution.dll (I can't reference it because as I already said DependencyResolution.dll have already reference to UI.dll), so therefore I lost the opportunity to debug this application in a regular manner of step into the code.
I thought maybe I can try use the attach to process feature, and debug the application on the localhost IIS (version 7 on windows 7 machine) but unfortunately it's not worked as expected. when an error occur the VS don't highlight the code, and I can't step in to it.
My question is what the best way to debug this kind of applications (CodeCampServer is a good example).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
仅仅因为您没有对 .dll 的引用并不意味着您无法调试该应用程序。您应该能够正常调试应用程序,但如果它抱怨缺少 DependencyResolution.dll,您可以将其手动复制到 bin 文件夹,或者编写一个为您执行此操作的构建后脚本。
Just because you don't have a reference to the .dll doesn't mean that you can't debug the application. You should be able to debug the application as normal, but if it complains about the missing DependencyResolution.dll, you can copy it to the bin folder manually, or write a post-build script that does it for you.