DataMemberにDataTableを設定した場合の注意事項

WCFでサービスからデータを受信しようとしたらエラーが発生した。
DataTableを受け渡しする場合、TableNameを設定しないとxml化できずにエラーとなる。

エラーメッセージだけじゃ判断できないからちょっと悩んでしまった。


Exception Type: System.ServiceModel.CommunicationException
Message: ソケット接続が中止されました。これは、メッセージ処理時のエラー、リモート ホストでの受信タイムアウトの超過、または基になるネットワーク リソースの問題が原因で発生する可能性があります。ローカル ソケットのタイムアウトは '01:04:59.9680000' でした。
Stack Trace:

Server stack trace:
場所 System.ServiceModel.Channels.StreamConnection.Read(Byte buffer, Int32 offset, Int32 size, TimeSpan timeout)
場所 System.ServiceModel.Channels.SessionConnectionReader.Receive(TimeSpan timeout)
場所 System.ServiceModel.Channels.SynchronizedMessageSource.Receive(TimeSpan timeout)
場所 System.ServiceModel.Channels.FramingDuplexSessionChannel.Receive(TimeSpan timeout)
場所 System.ServiceModel.Channels.FramingDuplexSessionChannel.TryReceive(TimeSpan timeout, Message& message)
場所 System.ServiceModel.Dispatcher.DuplexChannelBinder.Request(Message message, TimeSpan timeout)
場所 System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object
ins, Object outs, TimeSpan timeout)
場所 System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object
ins, Object[] outs)
場所 System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
場所 System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

Exception rethrown at [0]:
場所 System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
場所 System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
場所 *.IMyService.Hoge(MyParameter prm)
場所 *.MyService.Hoge(MyParameter prm) <- WCFサービス呼び出しの開始位置