I am developing a VS 2010 project at the moment. I have a command line program “X” that makes calls to a webservice. This compiles and runs fine itself.
However, I am trying to use the classes of this command line program in a separate project “Y”. To do this I have added a reference to project “X” in project “Y”. All is good and both projects compile OK.
However, when it comes to running project “Y”, the code falls over in project “X” because no end point could be found:
“Could not find default endpoint element that references contract
‘MyLocalService.MyServiceInterface’ in the ServiceModel client
configuration section. This might be because no configuration file was
found for your application, or because no endpoint element matching
this contract could be found in the client element.
I assume this is something to do with the fact that the config files in project “X” have not been imported into project “Y”… but how do I do this?
I think you are right. Configuration files (web.config and app.config) only apply to the process that is being executed. In Visual Studio, you can control this by setting the start-up project for the solution.
It sounds like you need to create or copy the configuration for your service into project “Y”. And then run it.