测试客户端 WCF 抛出错误 wjen 被调用
test client WCF throws error wjen invoked
我有 WCF 服务,我想测试它,当调用框出现并且我按下调用时,它会抛出一个错误,我用谷歌搜索了它,但到目前为止无法 运行 它,这里是我得到的错误:
实际错误信息:
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
这是我在本地主机上 运行 的配置:
<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>
在配置文件中,我们发布的服务有两个ways.one是restful风格,一个是soap web service。需要注意的一点是,WCF测试客户端一般用于测试soap web服务,而不是restful风格的服务,后者通常由Postman软件进行测试。因此,我建议您检查是否正在测试由 Basichttpbinding 创建的 soap web 服务。
此外,由于错误详情表明该服务无法访问和离线,请检查 IISExpress 是否正常托管该服务。我们可以点击右下角的IISExpress图标,然后查看运行网站。
如果问题仍然存在,请随时告诉我。
我有 WCF 服务,我想测试它,当调用框出现并且我按下调用时,它会抛出一个错误,我用谷歌搜索了它,但到目前为止无法 运行 它,这里是我得到的错误:
实际错误信息:
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
这是我在本地主机上 运行 的配置:
<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>
在配置文件中,我们发布的服务有两个ways.one是restful风格,一个是soap web service。需要注意的一点是,WCF测试客户端一般用于测试soap web服务,而不是restful风格的服务,后者通常由Postman软件进行测试。因此,我建议您检查是否正在测试由 Basichttpbinding 创建的 soap web 服务。
此外,由于错误详情表明该服务无法访问和离线,请检查 IISExpress 是否正常托管该服务。我们可以点击右下角的IISExpress图标,然后查看运行网站。
如果问题仍然存在,请随时告诉我。