WCF REST STARTERキットからRequestInterceptorを使用してリダイレクタ/リバースプロキシを実装することは可能ですか

StackOverflow https://stackoverflow.com/questions/6054310

  •  15-11-2019
  •  | 
  •  

質問

WCF RESTスタータキットからRequestInterceptorを使用してリバースプロキシを実装しようとしています。私は基本的なヘッダーのプロパティを設定して呼び出しを設定することができます。私は以下の側面に立ち往生しています:

  1. 適切な応答を返す - 私のWebServiceはテキスト+ XML、Image、またはJSONを返すことができます。適切な応答タイプを送信できません。Message.CreateMessageのオーバーロードはすべてSOAP整列しています。私はそれらをXElementに変換する必要があります - 私は間違いなくここに何か悪いことをしています。

  2. 私はまた、リバースプロキシがクッキー、gzip / deflate、およびsslの存在下で機能的に機能するようにしたいです。

    上記の要件に基づいて、RESTスターターキットを使用してこれを行うのは理にかなっていると思いますか?requestIntectoreceptorはかなり簡単に差し込むのが簡単でしたが、コードの残りのコードは私のナッツを運転しています。

役に立ちましたか?

解決

There is a mapping between both JSON and arbitrary binary content to XML which is used in messages for WCF (see some examples at http://blogs.msdn.com/b/carlosfigueira/archive/2011/04/19/wcf-extensibility-message-inspectors.aspx), so you can use Message.CreateMessage to create non-XML messages as well.

Having said that, it's really not intuitive to do that in WCF as of now. The new libraries in the WCF Web API - http://wcf.codeplex.com - provide a very nice way of intercepting / redirecting / bypassing the WCF pipeline especifically for HTTP messages. Also, it support multiple formats in a native way (i.e., without need to do some mapping to XML).

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top