使用 wcf Web 服务时无法将 pdb 文件复制到另一个目录

couldn't copy pdb file to another directory while consuming wcf web service

我有一个 WCF Web 服务,returns 传感器列出了一种方法。 当我想在调试模式下的控制台应用程序中使用此 Web 服务时,我收到了这 2 个错误;

Could not copy "obj\Debug\ConsumeHelper.pdb" to "bin\Debug\ConsumeHelper.pdb". Exceeded retry count of 10. Failed.  ConsumeHelper

Unable to copy file "obj\Debug\ConsumeHelper.pdb" to "bin\Debug\ConsumeHelper.pdb". The process cannot access the file 'bin\Debug\ConsumeHelper.pdb' because it is being used by another process. ConsumeHelper

此外,我正在添加如下所示的消费者方法。

        SensorServiceClient client = 
                    new SensorServiceClient("WebHttpBinding_ISensorService");
        Sensor[] sensor = client.getAllSensors("true");  
        Console.WriteLine("Sensor name is "  + sensor[0].Name);
        Console.ReadLine();

所以,有人可以给我解决方案吗?谢谢大家。

根据你最近的评论

ConsumeHelper is client project and it consumes WCF service

确保您还没有运行那个项目。我怀疑它已经是 运行,因此无法复制 pdb 文件。否则,在 Release 模式下尝试 运行 而不是 Debug 模式。