Why WCF cannot be invoked in wcftestclient? -


i built wcf service, works in ie addr, once add wcftestclient , invoke method, error prompted , shown :

failed invoke service. possible causes: service offline or inaccessible; client-side configuration not match proxy; existing proxy invalid. refer stack trace more detail. can try recover starting new proxy, restoring default configuration, or refreshing service.

error details:

the address property on channelfactory.endpoint null.  channelfactory's endpoint must have valid address specified.    @ system.servicemodel.channelfactory.createendpointaddress(serviceendpoint endpoint)    @ system.servicemodel.channelfactory`1.createchannel()    @ system.servicemodel.clientbase`1.createchannel()    @ system.servicemodel.clientbase`1.createchannelinternal()    @ system.servicemodel.clientbase`1.get_channel()    @ mydownloadsvcclient.deletemyfolder(int32 userid, int32 folderid) 

the config file is: (updated @ 10/9)

<?xml version="1.0" encoding="utf-8"?> <configuration>     <system.servicemodel>         <services>             <service name="mydownloadsvcclient">                 <endpoint binding="basichttpbinding" />             </service>         </services>         <bindings />         <client>             <endpoint address="http://localhost/mydownloadsvc.svc"                 binding="basichttpbinding" bindingconfiguration="" contract="imydownloadsvc"                 name="test" />         </client>     </system.servicemodel> </configuration> 

is there wrong?

thanks in advance, elaine

yes, there's wrong. service endpoint wcf must supply abc - address, binding, contract. define binding in config - , that's error message says - address null.

so config fragment should like:

<system.servicemodel>     <services>         <service name="mydownloadsvcclient">             <endpoint                  address="http://localhost:8888/yourservice"                 binding="basichttpbinding"                 contract="iyourservicecontract" />         </service>     </services> 

the address defines service endpoint lives, @ address it's available outside world. if have no address, service cannot talk outside where. it's there where of service. if host service in iis, using *.svc file, might leaving address empty, since service address determined server , virtual directory *.svc file lives - still need supply address="" entry service <service>/<endpoint> tag!

the binding defines how service interacts - protocol, security settings etc. - it's how of service.

and contract in end defines (through service contract, typically interface in service definition) service methods (functions) available caller. must supply contract, otherwise caller has no way of knowing methods can call on service. it's what of service.


Comments

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -