WCF WebサービスでWebメソッドの1つを使用すると、あいまいなエラーメッセージが表示されます。そのエラーメッセージは私が私の理論を投稿することを可能にするものは何も説明を提供しないので。
私が使っているリターンタイプと関係があるのではないかと思います
Webサービスとクライアントの両方で参照されるTypesDLLがあります。このDLLには、基本クラスExceptionMessagesがあります。このクラスには、DrawingExcepionsという子があります。
ここにいくつかのコードがあります:
public class ExceptionMessages
{
public object[] ReturnValue { get; set; }
}
public class DrawingExceptions : ExceptionMessages
{
private List<DrawingException> des = new List<DrawingException>();
}
public class DrawingException
{
public Exception ExceptionMsg { get; set; }
public List<object> Errors { get; set; }
}
使用コード:
[OperationContract]
ExceptionMessages createNewBom(Bom bom, DrawingFiles dfs);
public ExceptionMessages createNewBOM(Bom bom, DrawingFiles dfs)
{
return insertAssembly(bom, dfs);
}
public DrawingExceptions insertAssembly(Bom bom, DrawingFiles dfs)
{
DrawingExceptions des = new DrawingExceptions();
foreach (DrawingFile d in dfs.drawingFiles)
{
DrawingException temp = insertNewDrawing(bom, d);
if (temp != null)
des.addDrawingException(temp);
if (d.Child != null)
des.addDrawingException(insertAssembly(bom, d.Child));
}
return des;
}
に戻ります:
ExceptionMessages ems = client.createNewBom(bom, currentDFS);
if (ems is DrawingExceptions) { }
基本的に、webmethodからの戻りタイプはExceptionMessagesですが、通常は代わりに子クラスを送り返します。
私の唯一の考えは、エラーを引き起こしているのは子供であるということですが、私が読んだ限り、これは効果がないはずです。誰かがここで何がうまくいかない可能性があるかについて何か考えを持っていますか?
さらに情報が必要な場合は、質問してください:)
ありがとう。