简体   繁体   English

相同的Web服务项目,不同的配置,无法调试

[英]Same web service project, different configuration, can't debug

I have created a C# web service, a web client, and successfully debugged the service with ASP.NET Development Server (that thingy that gets activated when you just press F5). 我创建了一个C#Web服务,一个Web客户端,并使用ASP.NET Development Server成功调试了该服务(当您按F5键时,该东西便被激活)。 All fine. 一切都很好。 Now I need a web service that is almost the same as previous, but differs in a few lines of code. 现在,我需要一个与以前几乎相同的Web服务,但是在几行代码中有所不同。 For this purpose I created two new configurations, DebugNew and ReleaseNew, and set the output directory to binNew (instead of default "bin"). 为此,我创建了两个新配置DebugNew和ReleaseNew,并将输出目录设置为binNew(而不是默认的“ bin”)。 The problem is that original web service is executed in debugger, instead of new web service. 问题在于原始Web服务是在调试器中执行的,而不是新Web服务。 The debugger is unaware of binNew folder. 调试器不知道binNew文件夹。 How to set up the environment to start new web service if DebugNew configuration is active? 如果DebugNew配置处于活动状态,如何设置环境以启动新的Web服务?

As far as I know, web applications will only run out of the bin folder. 据我所知,Web应用程序只会用完bin文件夹。 If somebody knows how to change that, I would be happy to call myself wrong in order to learn that trick myself. 如果有人知道如何改变这种情况,我很乐意称自己是错误的,以便学习欺骗自己。

Assuming that I am actually correct for once there, you could write a post compile script that checks which build configuration is active. 假设我在那里确实是对的,那么您可以编写一个后编译脚本来检查哪个构建配置处于活动状态。 If it's either DebugNew or ReleaseNew, copy the contents from binNew to bin. 如果是DebugNew或ReleaseNew,请将内容从binNew复制到bin。

If there's really only a few lines of code different though, I question whether or not putting a configuration setting in and adjusting the code accordingly isn't a better way to go. 如果确实只有几行代码不同,我会怀疑是否放入配置设置并相应地调整代码不是更好的方法。 But, I certainly don't know all the facts. 但是,我当然不知道所有事实。 Just a thought I had. 只是我的一个想法。

I established a truce with Visual Studio (or unconditionally surrendered, depending on the point of view), and reverted output directory back to \\bin. 我与Visual Studio建立了休战(或视情况而定无条件投降),并将输出目录还原回\\ bin。 At least the setup project, which is in the same solution, maintains separate folders for each configuration. 至少在同一解决方案中的安装项目为每个配置维护单独的文件夹。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM