The communication object, System.ServiceModel.Channels.ServiceChannel, cannot be used for communication

前端 未结 14 1655
我寻月下人不归
我寻月下人不归 2020-12-04 05:43

The communication object, System.ServiceModel.Channels.ServiceChannel, cannot be used for communication because it is in the Faulted state.

14条回答
  •  情深已故
    2020-12-04 06:36

    To diagnose this problem, run the service under the Visual Studio debugger. Use the menu: Debug|Exceptions and indicate that you want to break when an Exception is thrown.

    The original exception thrown will have a much better error message than "..it is in the Faulted state."

    For example I was getting this exception from ServiceHost.Open(), but when I caught the original exception at the time it was thrown, the error message was:

    Service 'MyServiceName' has zero application (non-infrastructure) endpoints. This might be because no configuration file was found for your application, or because no service element matching the service name could be found in the configuration file, or because no endpoints were defined in the service element.

    Fixing the spelling error in App.config solved the problem.

提交回复
热议问题