Reputation: 13645
I have just started working with WCF and I have a question about location of App.config file.
I know that App.config/web.config files have to be added always at the end client location. I have a following design architecture:
WCF> DAL(I added service reference to this project) > DALUnitTest
Now, when I added the service reference to DAl project using VS, it automatically added the service reference to and related XML configurations like endPoint and everything into an App.Config file which was generated for DAL Project.
Now, I am writting unitests against the DAL project and it throws me following error:
Could not find default endpoint element that references contract 'HREmployeeWebService.IHREmployeeWebService' 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.
Until I copy the XML that was geenrated for DAL project and add it into Unitest project, the error goes away.
My questions is:
Upvotes: 0
Views: 1060
Reputation: 2294
VS will create the app.config file in the assembly where you create the service reference. And it will be used when updating the reference. That config file is totally separated from how your application will create and access the service configuration. If you are using the service reference in any application domain (like a unit test or web app) you will need to provide the configuration.
Upvotes: 1