c# - WCF - Client Endpoint Configuration Error -
c# - WCF - Client Endpoint Configuration Error -
in client application, i'm getting next error:
could not find endpoint element name 'queuedservice' , contract 'imyservice' in servicemodel client configuration section. might because no configuration file found application, or because no endpoint element matching name found in client element.
i used svutil.exe generate client proxy i'm using. typically hand-roll own proxy, , notice generated version of interface service contract not in namespace specified in service contract:
// auto-generated proxy namespace myservices.contracts { // request object in right namespace [system.runtime.serialization.datacontractattribute( name="myrequest", namespace="http://schemas.datacontract.org/2004/07/myservices.contracts")] public class myrequest { // ... } } // service contract not in namespace [system.servicemodel.servicecontractattribute( configurationname="imyservice")] public interface imyservice { // ... }
my host application web.config specifies service endpoints (one msmq , 1 tcp):
<system.servicemodel> <service> <!-- etc... --> <endpoint name="queuedservice" address="net.msmq://localhost/private/myqueue" binding="netmsmqbinding" bindingconfiguration="msmqdefaultbinding_local" contract="myservice.contracts.imyservice" /> <endpoint name="tcpservice" address="net.tcp://localhost/servicehost/theservice.svc" contract="myservices.contracts.imyservice" binding="nettcpbinding" bindingconfiguration="nettcpwindowsbinding" /> </service> </system.servicemodel>
the client app using service this:
var endpointconfigname = getendpointconfignamefromconfig(); using(var myserviceclient = new myserviceclient(endpointconfigname)) { // create request object... // phone call service so: myserviceclient.someservicemethod(requestobject); }
and client's web.config:
<client> <endpoint name="queuedservice" address="net.msmq://localhost/private/myqueue" binding="netmsmqbinding" bindingconfiguration="msmqdefaultbinding_local" contract="myservices.contracts.imyservice" /> <endpoint name="tcpservice" address="net.tcp://localhost/servicehost/theservice.svc" contract="myservices.contracts.imyservice" binding="nettcpbinding" bindingconfiguration="nettcpwindowsbinding" /> </client>
any ideas???
seems configurationname in generated proxy imyservice rather myservices.contracts.imyservice. in clients web.config can have contract imyservice rather finish 1 , test if works.
c# .net wcf wcf-binding wcf-client
Comments
Post a Comment