Configure WCFservice client using web.config when added as connected service (sdk-project style)

150 Views Asked by At

We converted our projects to the 'new' SDk format csproj files. To add a new WCF webservice we right-click the project and choose: Add => Connected Service. Then we choose 'Microsoft WCF Web Service Reference Provider'. That all works, but the generated code does not contain an option to pass an endpoint name to the service-client constructor (which was an option in the older csproj add service reference option) so it would do a lookup in the web.config-file to configure the service (endpoint and behaviours e.d).

It looks configuration is all hardcoded in the generated service code file (servicereference.cs). I know it's a partial class and could just add an extra constructor accepting an endpoint name as a string like ctor(string enpointname):base(endpointname){} but i'm lazy and believe it should be able to work out of the box.

1

There are 1 best solutions below

0
P. Zantinge On

I think the question (and comments) contains the answer already. The only way to use the Config-file is to add a constructor in partial class in a new file.