c# - Cant connect to WCF Service. Missing EndPointElemt -
i'm trying create own wcf service , client. i've created service following app.config settings:
<system.servicemodel> <services> <service name="interface.mywcfservice"> <endpoint address="http://localhost:9999/myservice" binding="basichttpbinding" bindingconfiguration="" name="myserviceendpoint" contract="interface.imywcfservice" /> </service> </services> </system.servicemodel> the service starts without exception.
my client should connect service. app.config one:
<?xml version="1.0" encoding="utf-8" ?> <configuration> <system.servicemodel> <client> <endpoint address="http://localhost:9999/myservice" binding="basichttpbinding" bindingconfiguration="" contract="interface.imywcfservice" name="myserviceendpoint" kind="" endpointconfiguration="" /> </client> </system.servicemodel> </configuration> in c# code try create channelfactory in client.cs following code:
channelfactory<imywcfservice> channelfactory = new channelfactory<imywcfservice>("myserviceendpoint", new endpointaddress("http://localhost:9999/myservice")); imywcfservice proxy = channelfactory.createchannel(); this not working. every time try start program following exception:
no endpointelement name "myserviceendpoint" , contract "interface.imywcfservice" found in servicemodel-clientconfigurationsection.
i hope can me.
this how have service configured:
<service name="foo.bar.blaservice"> <host> <baseaddresses> <add baseaddress="http://localhost/blaservice" /> </baseaddresses> </host> <endpoint address="" binding="basichttpbinding" contract="foo.bar.iblaservice" /> <endpoint address="mex" binding="mexhttpbinding" contract="imetadataexchange" /> </service> and here client:
<client> <endpoint name="blaservice" address="http://localhost/blaservice" binding="basichttpbinding" contract="foo.bar.iblaservice" /> </client>
Comments
Post a Comment