c# - EndpointNotFoundException on call to operation of running RESTful WCF service -


i have strange problem 1 of wcf services. i'm pretty sure people have experimented wcf services have had endpointnotfoundexception thrown when endpoint had not been set correctly in 1 of configuration files. endpointnotfoundexception class page on msdn:

the exception thrown when remote endpoint not found or reached.

further on, continues:

the endpoint may not found or reachable because remote endpoint down, remote endpoint unreachable, or because remote network unreachable.

this not reflect situation. seems receiving endpointnotfoundexception when working wcf not unusual, exception not thrown when first trying access service... instead, thrown when trying call 1 of operations of service:

using (exportconfirmationserviceclient client = new exportconfirmationserviceclient(     "webhttpbinding_iexportconfirmationservice")) // <-- exception not thrown here {     ...     component releaseconfirmation = deserializetestxmlfile(filepath);     client.addexportconfirmation("5051275066302", releaseconfirmation);     // exception thrown on call service operation on line above     ... } 

interestingly, exception message includes name of operation in mentioned file path:

there no endpoint listening @ http://domain/folder/servicename.svc/operationname accept message. caused incorrect address or soap action. see innerexception, if present, more details.

the inner exception has following message:

the remote server returned error: (404) not found.

this particularly confusing me can browse service url , see default you have created service page:

enter image description here

also, if navigate path in exception message, see endpoint not found message on page:

enter image description here

however, if navigate operation page of 1 of other, working wcf services, standard 400 bad request error browser, though operation works fine. seem me if original endpointnotfoundexception could red herring... i'm not sure though, i've not spent time working wcf.

i'll show web.config (server side) here in case needs see it:

<?xml version="1.0"?> <configuration>         <system.web>         <compilation debug="true" targetframework="4.0" />     </system.web>     <system.servicemodel>         <behaviors>             <servicebehaviors>                 <behavior name="midas.webconfirmations.exportconfirmationservicebehaviour">                     <servicemetadata httpgetenabled="true" />                     <servicedebug includeexceptiondetailinfaults="false" />                 </behavior>             </servicebehaviors>             <endpointbehaviors>                 <behavior name="webhttp">                     <webhttp />                 </behavior>             </endpointbehaviors>         </behaviors>         <servicehostingenvironment multiplesitebindingsenabled="false" />         <services>             <service name="midas.webconfirmations.exportconfirmationservice" behaviorconfiguration="midas.webconfirmations.exportconfirmationservicebehaviour">                 <endpoint address="" binding="webhttpbinding" contract="midas.webconfirmations.iexportconfirmationservice" behaviorconfiguration="webhttp" />                 <endpoint address="mex" binding="mexhttpbinding" contract="imetadataexchange" />             </service>         </services>     </system.servicemodel>     <system.webserver>         <modules runallmanagedmodulesforallrequests="true"/>     </system.webserver> </configuration> 

this client app.config (bear in mind references 2 wcf services):

<?xml version="1.0" encoding="utf-8"?> <configuration>     <system.servicemodel>         <bindings>             <basichttpbinding>                 <binding name="basichttpbinding_idataservice" closetimeout="00:01:00" opentimeout="00:01:00" receivetimeout="00:10:00" sendtimeout="00:01:00" allowcookies="false" bypassproxyonlocal="false" hostnamecomparisonmode="strongwildcard" maxbuffersize="65536" maxbufferpoolsize="524288" maxreceivedmessagesize="65536" messageencoding="text" textencoding="utf-8" transfermode="buffered" usedefaultwebproxy="true">                     <readerquotas maxdepth="32" maxstringcontentlength="8192" maxarraylength="16384" maxbytesperread="4096" maxnametablecharcount="16384" />                     <security mode="none">                         <transport clientcredentialtype="none" proxycredentialtype="none" realm="" />                         <message clientcredentialtype="username" algorithmsuite="default" />                     </security>                 </binding>             </basichttpbinding>             <webhttpbinding>                 <binding name="webhttpbinding_iexportconfirmationservice" allowcookies="true" maxreceivedmessagesize="20000000" maxbuffersize="20000000" maxbufferpoolsize="20000000">                     <readerquotas maxdepth="32" maxarraylength="200000000" maxstringcontentlength="200000000"/>                 </binding>             </webhttpbinding>         </bindings>         <behaviors>             <servicebehaviors>                 <behavior name="midas.webconfirmations.exportconfirmationservicebehaviour">                     <servicemetadata httpgetenabled="true" />                     <servicedebug includeexceptiondetailinfaults="false" />                 </behavior>             </servicebehaviors>             <endpointbehaviors>                 <behavior name="webendpointbehavior">                     <webhttp defaultbodystyle="wrapped" defaultoutgoingresponseformat="xml" helpenabled="true"/>                 </behavior>             </endpointbehaviors>         </behaviors>         <client>             <endpoint address="http://devbucket.ministryofsound.mos.local/midaswebservices/dataservice.svc" binding="basichttpbinding" bindingconfiguration="basichttpbinding_idataservice" contract="midas.webserviceclients.idataservice" name="basichttpbinding_idataservice" />             <endpoint address="http://devbucket.ministryofsound.mos.local/midaswebconfirmations/exportconfirmationservice.svc" binding="webhttpbinding" bindingconfiguration="webhttpbinding_iexportconfirmationservice" behaviorconfiguration="webendpointbehavior" contract="iexportconfirmationservice" name="webhttpbinding_iexportconfirmationservice" />         </client>     </system.servicemodel> </configuration> 

so if of great minds frequent stack overflow shed light on problem me, i'd appreciate it.


update >>>

in response first few comments, suspected problem caused exception being thrown server side code, simplified operation code dramatically... this, still same error:

public void addexportconfirmation(string upc, component ingestionfeedback) {     weboperationcontext.current.outgoingresponse.statuscode = httpstatuscode.ok; } 

also, did set tracing, worked on client side, told me knew. have @ link provided @bigdaddy, in case shows how set tracing on server side.

in response tewr, generated service client using svcutil.exe, tried adding service reference , letting visual studio create reference me... both methods resulted in same error. also, have been updating service references day, i've been making changes. includeexceptiondetailinfaults="true" setting didn't make difference, i'll try adding dummy operation service , try view in browser.


update 2 >>>

ok, added simple getter method service , updated references round @tewr suggested. has made me more confused... method:

[xmlserializerformat()] [operationcontract] [webget()] string getstring(); 

the implementation returns string , see value when access service in web browser: enter image description here
however, still same error code, when calling same new operation... mean?


update 3 >>>

after taking advice comments, set service trace on service again... still couldn't 1 working on server, on client, did output trace file. in file, see invalidoperationexception following message:

envelope version 'envelopenone (http://schemas.microsoft.com/ws/2005/05/envelope/none)' not support adding message headers.

i'm researching now, if know error about, please let me know.

the problem wcf is complex, exceptions cover many different errors each , exception messages vague. limited experience, seems error message 1 thing, wholly, or partly irrelevant actual problem. kept fixing errors, unlocked new exceptions (and still haven't come end of them yet!), purpose of question, there is answer.

so turned out original endpointnotfoundexception actually thrown because there unhandled exception in addexportconfirmation service method implementation. once had simplified code (as in first question update), particular exception went away , replaced next one.


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -