2012-02-02 1 views
1

間違ったWCFリクエストが送信されたときにWCFがエラーを返す前に例外(ログリクエストURL)を検出する方法を知りたい。例えばWCFがクライアントリクエストを終了する前にWCFにフックする

、私は下の間違ったアクション要素を使用してWCF要求を投稿するフィドラーを使用します。

<a:Action s:mustUnderstand="1">http://www.xxx.com/Wrong</a:Action> 

WCFサービスは、クライアントに以下のエラーを返し、要求を終了します。どのように要求URLをキャッチする、WCFが終了する前に例外をキャッチします。 WCFから返さ

例外:

http://www.w3.org/2005/08/addressing/faulturn:uuid:872ca27f-24c8-4855-8739-e36bd1d921e71e67f1d2-7550-4c41-88cf-acdf8ebd6bd4s:Sendera:ActionNotSupportedThe message with Action 'http://www.xxx.com/Wrong' cannot be processed at the receiver, due to a ContractFilter mismatch at the EndpointDispatcher. This may be because of either a contract mismatch (mismatched Actions between sender and receiver) or a binding/security mismatch between the sender and the receiver. Check that sender and receiver have the same contract and the same binding (including security requirements, e.g. Message, Transport, None). 


<?xml version="1.0" encoding="UTF-8"?> 
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing"> 
    <s:Header> 
    <a:Action s:mustUnderstand="1">http://www.xxx.com/Wrong</a:Action> 

    </a:ReplyTo> 
    <a:To s:mustUnderstand="1">http://www.xxx.com/Service.svc</a:To> 
    </s:Header> 
</s:Envelope> 

私はシオマネキを使用する場合、実際の要求URLを要素に持つものとは異なる場合がありますのでご注意ください。

答えて

1

IErrorHandlerインターフェイスをご覧ください。正しく設定されていれば、すべての例外が流れます。私はそれを試していないが、あなたが欲しいものを記録することができますHandleError内。 OperationContextは、探しているデータを提供します。これを見てくださいsample

+0

ありがとうございます。私はそれを試し、私の結果を更新します。 – Pingpong

関連する問題