WCF: How can I programmatically recreate these App.config values?

后端 未结 2 1847
一个人的身影
一个人的身影 2020-12-05 16:16

I have a WCF service that works ok if I create the service without specifying any binding or endpoint (it reads it from the generated values in the App.config when I registe

2条回答
  •  一整个雨季
    2020-12-05 16:53

    Well, the client endpoint in the config specifies this URL:

     

    but in your code sample, you create:

     EndpointAddress endpointAddress = new EndpointAddress( "my.uri.com/service.svc" );
    

    The addresses must match - if the one in the config works, you'll need to change your code to:

     EndpointAddress endpointAddress = new EndpointAddress( "http://www.myuri.com/Services/Services.svc/basic" );
    

    Mind you - there are various little typos in your code sample (my.uri.com vs. www.myuri.com, /service.svc instead of /Services/Services.svc).

    Does it work with the corrected endpoint address?

    Marc

提交回复
热议问题