c# - Failed to invoke the service. Possible causes: The service is offline or inaccessible while Invoking -


i have service configured below:

<system.servicemodel>     <services>       <service name="wcfservice1.service1" behaviorconfiguration="myservicetypebehaviors">         <host>           <baseaddresses>             <add baseaddress="net.tcp://127.0.0.1:808/service" />           </baseaddresses>         </host>         <endpoint address="net.tcp://127.0.0.1:808/service/"                   binding="nettcpbinding"                   contract="wcfservice1.iservice1"/>         <endpoint address="mex" binding="mextcpbinding" contract="imetadataexchange"   />        </service>     </services>     <protocolmapping>       <add scheme="net.tcp" binding="nettcpbinding"/>     </protocolmapping>     <behaviors>       <servicebehaviors>         <behavior name="myservicetypebehaviors">           <servicemetadata httpgetenabled="true"/>         </behavior>       </servicebehaviors>     <endpointbehaviors>       <behavior name="myendpointbehaviour">         <webhttp/>       </behavior>     </endpointbehaviors>     </behaviors>     <servicehostingenvironment aspnetcompatibilityenabled="true" multiplesitebindingsenabled="true" />   </system.servicemodel> 

and client as:

 <system.servicemodel>         <bindings>             <nettcpbinding>                 <binding name="nettcpbinding_iservice1" sendtimeout="00:05:00" />             </nettcpbinding>         </bindings>         <client>             <endpoint address="net.tcp://127.0.0.1/service/" binding="nettcpbinding"                 bindingconfiguration="nettcpbinding_iservice1" contract="iservice1"                 name="nettcpbinding_iservice1">                 <identity>                     <serviceprincipalname value="host/machinename" />                 </identity>             </endpoint>         </client>     </system.servicemodel> 

when using wcftestclient or svcutil, able discover , access servie , generate proxy or stubs.

but when want invoke of methods getting following error:

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.

the socket connection aborted. caused error processing message or receive timeout being exceeded remote host, or underlying network resource issue. local socket timeout '00:04:59.9980468'.

maybe not answer looking for, development on local machine use http endpoint. find net.tcp play nice when hosted on server in iis.

it easy enough add net.tcp endpoints once deploy iis server. note: base address no longer has affect set in iis. test new endpoints best start opening service in browser while remoted server, way best error messages.

if understand correctly trying select endpoint when creating service reference? thats how works. if create service reference using 127.0.0.1/service/service1.svc

you should see in config file following. (when create service endpoints name them protocol suffix.

        <endpoint address="http://servername:8090/servername/servername.svc/business"               binding="basichttpbinding" bindingconfiguration="businesshttp"               contract="servername.iservice" name="businesshttp" />        <endpoint address="net.tcp://servername:8030/service/service.svc/business"               binding="nettcpbinding" bindingconfiguration="businesstcp"               contract="servername.iservice" name="businesstcp" /> 

then in code can choose endpoint use.

dim svc new sevicereferencename.businessclient("businesstcp")" 

Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -