moris62
moris62

Reputation: 1045

test client WCF throws error wjen invoked

I have WCF service which i want to test it,when the invoke box appears and i press invoke,it throws an error ,i have googled it but so far not able to run it,here the error i get:

The actual error message:

Failed to invoke the service. Possible causes: The service is offline or inaccessible; the client-side configuration does not match the proxy; the existing proxy is invalid. Refer to the stack trace for more detail. You can try to recover by starting a new proxy, restoring to default configuration, or refreshing the service.

    at System.ServiceModel.Channels.ServiceChannel.ThrowIfFaultUnderstood(Message reply, MessageFault fault, String action, MessageVersion version, FaultConverter faultConverter)
           at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)
           at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
           at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
           at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

            Exception rethrown at [0]: 
               at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
               at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
               at ITurbineMonitorService.SetStatus(String turbineId, StatusChangeEventData statusChangeEvent)
               at TurbineMonitorServiceClient.SetStatus(String turbineId, StatusChangeEventData stat

here is my config which i run on localhost:

 <serviceBehaviors>
    <behavior>
      <!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
      <serviceMetadata httpGetEnabled="false" />
      <!-- To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information -->
      <serviceDebug includeExceptionDetailInFaults="true" />
    </behavior>
  </serviceBehaviors>
</behaviors>
<services>
  <service name="TurbineMonitor.TurbineMonitor">
    <endpoint address="" behaviorConfiguration="REST" binding="webHttpBinding" contract="TurbineMonitor.ITurbineMonitorService" />
    <endpoint address="soap" binding="basicHttpBinding" contract="TurbineMonitor.ITurbineMonitorService" />
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
  </service>
</services>

Upvotes: 0

Views: 47

Answers (1)

Abraham Qian
Abraham Qian

Reputation: 7522

In the configuration file, we publish the service in two ways.one is restful style and the other is soap web service. One thing we should pay attention to is that WCF test client generally is used to test soap web service instead of restful style service, the latter is usually tested by Postman software. Therefore, I suggest you check whether you are testing the soap web service created by Basichttpbinding.
enter image description here
Besides, since the error details indicate that the service is inaccessible and offline, please check if IISExpress hosting the service properly. We are able to click the IISExpress icon at the bottom right corner and then check the running website.
Feel free to let me know if the problem still exists.

Upvotes: 1

Related Questions