我有一个 WCF 服务,该服务在本地工作,并且以前在单独的服务器上工作(在微小更改之前)。它现在抛出“无法识别的消息版本”CommunicationException。这可能是什么原因造成的?
在故障排除中,我发现它在服务器上的 WCF“魔术”中某处发生,然后才解析为使用为其定义的自定义绑定。
服务器本身最近对其进行了一些修改以添加 SSL 和更改主机名,所以我想知道在 IIS (7.5) 查找服务和我的代码被调用之间是否发生了特定于服务器的事情。
我的服务继承自一个基类,该基类包含一个简单的 Ping 方法,一旦联系就返回成功。这适用于所有其他内部服务器部署,但即使调用此方法现在也会给出无法识别的消息版本。
调用代码只是使用 VS 生成的服务引用来创建一个实例然后调用它:
var MyService = new MyNamespace.MyServiceClient();
var result = MyService.Ping();
更新 堆栈跟踪(不存在 InnerException)让我想知道它是否与 SOAP 相关:
Server stack trace:
at System.ServiceModel.Channels.ReceivedMessage.ReadStartEnvelope(XmlDictionaryReader reader)
at System.ServiceModel.Channels.BufferedMessage..ctor(IBufferedMessageData messageData, RecycledMessageState recycledMessageState, Boolean[] understoodHeaders, Boolean understoodHeadersModified)
at System.ServiceModel.Channels.TextMessageEncoderFactory.TextMessageEncoder.ReadMessage(ArraySegment`1 buffer, BufferManager bufferManager, String contentType)
at System.ServiceModel.Channels.MessageEncoder.ReadMessage(Stream stream, BufferManager bufferManager, Int32 maxBufferSize, String contentType)
at System.ServiceModel.Channels.HttpInput.ReadChunkedBufferedMessage(Stream inputStream)
at System.ServiceModel.Channels.HttpInput.ParseIncomingMessage(Exception& requestException)
at System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
at System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)
at System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout)
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 Lenderprise.WebServiceHost.Test.LLSSTitleSearch.ITitleSearch.Ping()
at Lenderprise.WebServiceHost.Test.LLSSTitleSearch.TitleSearchClient.Ping() in D:\LLN\DEV\LenderPrise\WebServices\TitleSearchWebServiceHost.Test\Service References\LLSSTitleSearch\Reference.cs:line 138
at Lenderprise.MainWindow.RunAsLibraryButton_Click(Object sender, RoutedEventArgs e) in D:\LLN\DEV\LenderPrise\WebServices\TitleSearchWebServiceHost.Test\MainWindow.xaml.cs:line 91
有什么建议么?