Search code examples
c#web-servicesvisual-studio-2010webservertaskkill

Killing webservices everytime I start my solution


I have 5 services running when my application starts up in VS2010. And everytime I get this error:

Error 24 Unable to copy file "C:\My Project\Main\Entities\bin\Debug\Test.Testing.dll" to "bin\Test.Testing.dll". The process cannot access the file 'bin\Test.Testing.dll' because it is being used by another process.

Error 26 Unable to copy file "C:\My Project\Main\Entities\bin\Debug\Test.Testing1.dll" to "bin\Test.Testing1.dll". The process cannot access the file 'bin\Test.Testing1.dll' because it is being used by another process.

Error 23 Unable to copy file "C:\My Project\Main\Entities\bin\Debug\Test.Testing2.dll" to "bin\Test.Testing2.dll". The process cannot access the file 'bin\Test.Testing2.dll' because it is being used by another process.

Error 25 Unable to copy file "C:\My Project\Main\Entities\bin\Debug\Test.Testing3.dll" to "bin\Test.Testing3.dll". The process cannot access the file 'bin\Test.Testing3.dll' because it is being used by another process.

Error 27 Unable to copy file "C:\My Project\Main\Entities\bin\Debug\Test.Testing4.dll" to "bin\Test.Testing4.dll". The process cannot access the file 'bin\Test.Testing4.dll' because it is being used by another process.

To kill these web services I have to create a 'bat' file: taskkill /F /IM WebDev.WebServer40.EXE

Does anyone has any idea why this happens. Seems like my web services dont stop whenever I close the application?


Solution

  • I think I know what you are talking about. Go to WCF Library Project properties, WCF options tab and uncheck the checkbox saying "Start WCF Service Host when debugging another project in the same solution".

    Instead of this service host, if required, write console based hosts and run them from a different solution (at least thats what I did).