c# - There Was No Endpoint Listening at http // That Could Accept The Message in WCF -


i trying develop webservice. in application need connect webservice without referencing, use code:

static void main(string[] args) {                  basichttpbinding binding = new basichttpbinding();     endpointaddress address = new endpointaddress("http://confdemo.spadsystem.com/wcfservicelibrary1.service1.svc");     channelfactory<iservice1> factory = new channelfactory<iservice1>(binding, address);     iservice1 channel = factory.createchannel();      console.writeline(channel.getcategoryname(1));     console.readline(); } 

but in line channel.getcategoryname(1) error :

there no endpoint listening @ http://confdemo.spadsystem.com/wcfservicelibrary1.service1.svc accept message. caused incorrect address or soap action. see innerexception, if present, more details. 

here service webconfig:

<?xml version="1.0" encoding="utf-8" ?> <configuration>   <appsettings>     <add key="aspnet:usetaskfriendlysynchronizationcontext" value="true" />   </appsettings>   <system.web>     <customerrors mode="off"/>     <compilation debug="true" />   </system.web>   <!-- when deploying service library project, content of config file must added host's    app.config file. system.configuration not support config files libraries. -->   <system.servicemodel>     <servicehostingenvironment multiplesitebindingsenabled="true">     </servicehostingenvironment>     <services>       <service name="wcfservicelibrary1.service1">         <host>           <baseaddresses>             <add baseaddress = "http://localhost:8733/design_time_addresses/wcfservicelibrary1/service1/" />           </baseaddresses>         </host>         <!-- service endpoints -->         <!-- unless qualified, address relative base address supplied above -->         <endpoint address="confdemo.spadsystem.com/wcfservicelibrary1.service1.svc" binding="basichttpbinding" contract="wcfservicelibrary1.iservice1">           <!--                upon deployment, following identity element should removed or replaced reflect                identity under deployed service runs.  if removed, wcf infer appropriate identity                automatically.           -->           <identity>             <dns value="localhost"/>           </identity>         </endpoint>         <!-- metadata endpoints -->         <!-- metadata exchange endpoint used service describe clients. -->          <!-- endpoint not use secure binding , should secured or removed before deployment -->         <endpoint address="mex" binding="mexhttpbinding" contract="imetadataexchange"/>       </service>     </services>     <behaviors>       <servicebehaviors>         <behavior>           <!-- avoid disclosing metadata information,            set values below false before deployment -->           <servicemetadata httpgetenabled="true" httpsgetenabled="true"/>           <!-- receive exception details in faults debugging purposes,            set value below true.  set false before deployment            avoid disclosing exception information -->           <servicedebug includeexceptiondetailinfaults="false" />         </behavior>       </servicebehaviors>     </behaviors>   </system.servicemodel>  </configuration> 

note:when add reference works, doesn't work when don't add reference .

the error stacktrace:

system.servicemodel.endpointnotfoundexception unhandled user code   hresult=-2146233087   message=there no endpoint listening @ http://confdemo.spadsystem.com/wcfservicelibrary1.service1.svc accept message. caused incorrect address or soap action. see innerexception, if present, more details.   source=mscorlib   stacktrace:     server stack trace:         @ system.servicemodel.channels.httpchannelutilities.processgetresponsewebexception(webexception webexception, httpwebrequest request, httpabortreason abortreason)        @ system.servicemodel.channels.httpchannelfactory`1.httprequestchannel.httpchannelrequest.waitforreply(timespan timeout)        @ system.servicemodel.channels.requestchannel.request(message message, timespan timeout)        @ system.servicemodel.dispatcher.requestchannelbinder.request(message message, timespan timeout)        @ system.servicemodel.channels.servicechannel.call(string action, boolean oneway, proxyoperationruntime operation, object[] ins, object[] outs, timespan timeout)        @ system.servicemodel.channels.servicechannelproxy.invokeservice(imethodcallmessage methodcall, proxyoperationruntime operation)        @ system.servicemodel.channels.servicechannelproxy.invoke(imessage message)     exception rethrown @ [0]:         @ system.runtime.remoting.proxies.realproxy.handlereturnmessage(imessage reqmsg, imessage retmsg)        @ system.runtime.remoting.proxies.realproxy.privateinvoke(messagedata& msgdata, int32 type)        @ wcfservicelibrary1.iservice1.getcategoryname(int32 productid)        @ webapplication1.webform1.page_load(object sender, eventargs e) in c:\users\ehsan\documents\visual studio 2012\projects\wcfservice1\webapplication1\webform1.aspx.cs:line 20        @ system.web.util.callieventhandlerdelegateproxy.callback(object sender, eventargs e)        @ system.web.ui.control.onload(eventargs e)        @ system.web.ui.control.loadrecursive()        @ system.web.ui.page.processrequestmain(boolean includestagesbeforeasyncpoint, boolean includestagesafterasyncpoint)   innerexception: system.net.webexception        hresult=-2146233079        message=the remote server returned error: (404) not found.        source=system        stacktrace:             @ system.net.httpwebrequest.getresponse()             @ system.servicemodel.channels.httpchannelfactory`1.httprequestchannel.httpchannelrequest.waitforreply(timespan timeout)        innerexception 

you said worked when added references. guess have issue in endpoint.

according code expecting endpoint http://confdemo.spadsystem.com/wcfservicelibrary1.service1.svc. actual endpoint http://confdemo.spadsystem.com/wcfservicelibrary1.service1.svc/confdemo.spadsystem.com/wcfservicelibrary1.service1.svc.

in wsdl shows url

<wsdl:service name="service1"> <wsdl:port name="basichttpbinding_iservice1" binding="tns:basichttpbinding_iservice1">  <soap:address location="http://confdemo.spadsystem.com /wcfservicelibrary1.service1.svc/confdemo.spadsystem.com/wcfservicelibrary1.service1.svc"/> </wsdl:port> </wsdl:service> 

i think part web.config not correct.

<endpoint address="confdemo.spadsystem.com/wcfservicelibrary1.service1.svc" binding="basichttpbinding" contract="wcfservicelibrary1.iservice1">


Comments

Popular posts from this blog

Delphi XE2 Indy10 udp client-server interchange using SendBuffer-ReceiveBuffer -

Qt ActiveX WMI QAxBase::dynamicCallHelper: ItemIndex(int): No such property in -

Enable autocomplete or intellisense in Atom editor for PHP -