开发者

WCF writing directly to the response channel

开发者 https://www.devze.com 2022-12-17 19:40 出处:网络
is开发者_开发技巧 there a way to write ( a string for example ) directly to the output stream, when implementing a regular WCF interface like this:

is开发者_开发技巧 there a way to write ( a string for example ) directly to the output stream, when implementing a regular WCF interface like this:

[ServiceContract]
public interface ISearchInterface
{
    [OperationContract]
    [FaultContract(typeof(Exception))]
    SearchResponse SearchXML(SearchRequest req);
}

I want to save de/serialization time and send the serialzed string directly( it HAS to be the same method, though, because when i haven't got the serialized cachestring, i want to normally "build" the serialized object by some SQL statements... )

Any ideas? Something like

Channel.Write(s);

??


In one word: NO.

WCF is a message-based communication system - there is NO direct link between the server and your client at any time. All that goes between client and server are serialized messages - you can only exchange static data - there's no "object remoting" capability or anything like that in WCF. Heck - the messages between client and server could be sent by pigeons for all I know. And no, there's no way to send something back "directly over the channel" bypassing serialization - the response from the server must be serialized into a message and that message is sent back as a response to the client.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号