Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > Indigo

Vista - WSStreamedHttpBinding : how does it works ?

 
 
Old 10-26-2006   #1 (permalink)
Steve B.


 
 

WSStreamedHttpBinding : how does it works ?

Hi,

In a previous post I've a problem with transfering file using wshttpbinding.
An answer was to check the MS sample : WSStreamedHttpBinding in order to
allow using Stream in operation.

However, and even with the help shipped with the sample, I don't understand
what in the WSStreamedHttpBinding sample allow to use stream, there is no
reference of the stream class in the code...

Can someone explain why this binding sample allow transfert of stream ?

Thanks,
Steve



My System SpecsSystem Spec
Old 10-26-2006   #2 (permalink)
Arkady Frenkel


 
 

Re: WSStreamedHttpBinding : how does it works ?

That because of "transfermode" attribute in config file ( look at
http://windowssdk.msdn.microsoft.com...nsfermode.aspx )
transferMode="Streamed"

Arkady

"Steve B." <steve_beauge@com.msn_swap_msn_and_com> wrote in message
news:u7qGATN%23GHA.3344@TK2MSFTNGP03.phx.gbl...
> Hi,
>
> In a previous post I've a problem with transfering file using
> wshttpbinding.
> An answer was to check the MS sample : WSStreamedHttpBinding in order to
> allow using Stream in operation.
>
> However, and even with the help shipped with the sample, I don't
> understand what in the WSStreamedHttpBinding sample allow to use stream,
> there is no reference of the stream class in the code...
>
> Can someone explain why this binding sample allow transfert of stream ?
>
> Thanks,
> Steve
>



My System SpecsSystem Spec
Old 10-27-2006   #3 (permalink)
Steve B.


 
 

Re: WSStreamedHttpBinding : how does it works ?

I'm still having troubles to make it working.
Since I'm in a P2P pattern, host application acts both as client and server.
According one of your advise, I do not use the service reference dialog of
VS, but instead, I use the channelfactory :

ChannelFactory<IDestination> channelFactory = new ChannelFactory<IMyService
>(


new WSStreamedHttpBinding("StreamedBinding"),

new EndpointAddress(remoteUri)

);


IMyService proxy = channelFactory.CreateChannel();

proxy.DoIt(

File.OpenRead(sourceFile)

);

The app.config of the host (which is a console application) has this
configuration (only usefull lines are pasted) :

<service behaviorConfiguration="FileDestinationServiceBehavior"

name="MyService">

<endpoint binding="wsStreamedHttpBinding"
bindingConfiguration="StreamedBinding"

contract="IMyService" />

</service>

....

<bindings>

<wsStreamedHttpBinding>

<binding name="StreamedBinding" transferMode="Streamed"
securityMode="None"/>

</wsStreamedHttpBinding>

</bindings>



However, when the application reach the DoIt method, it throws an exception
saying the FileStream is not serializable... even if the transfertMode is
set to Streamed.



I'm quite lost in this quite simple prototype... What is wrong ?

Thanks in advance,

Steve


System.Runtime.Serialization.InvalidDataContractException was unhandled by
user code
Message="Type 'System.IO.FileStream' cannot be serialized. Consider
marking it with the DataContractAttribute attribute, and marking all of its
members you want serialized with the DataMemberAttribute attribute."
Source="mscorlib"
StackTrace:
Server stack trace:
at
System.Runtime.Serialization.DataContract.ThrowInvalidDataContractException(String
message, Type type)
at System.Runtime.Serialization.DataContract.CreateDataContract(Int32
id, RuntimeTypeHandle typeHandle, Type type)
at
System.Runtime.Serialization.DataContract.GetDataContractSkipValidation(Int32
id, RuntimeTypeHandle typeHandle, Type type)
at
System.Runtime.Serialization.DataContract.GetDataContract(RuntimeTypeHandle
typeHandle, Type type, SerializationMode mode)
at
System.Runtime.Serialization.XmlObjectSerializerContext.GetDataContract(RuntimeTypeHandle
typeHandle, Type type)
at
System.Runtime.Serialization.XmlObjectSerializerWriteContext.SerializeWithXsiType(XmlWriterDelegator
xmlWriter, Object obj, RuntimeTypeHandle objectTypeHandle, Type objectType,
Int32 declaredTypeID, RuntimeTypeHandle declaredTypeHandle, Type
declaredType)
at
System.Runtime.Serialization.XmlObjectSerializerWriteContext.InternalSerialize(XmlWriterDelegator
xmlWriter, Object obj, Boolean isDeclaredType, Boolean writeXsiType, Int32
declaredTypeID, RuntimeTypeHandle declaredTypeHandle)
at
System.Runtime.Serialization.XmlObjectSerializerWriteContext.InternalSerializeReference(XmlWriterDelegator
xmlWriter, Object obj, Boolean isDeclaredType, Boolean writeXsiType, Int32
declaredTypeID, RuntimeTypeHandle declaredTypeHandle)
at WriteFileCopyInfoToXml(XmlWriterDelegator , Object ,
XmlObjectSerializerWriteContext , ClassDataContract )
at
System.Runtime.Serialization.XmlFormatClassWriterDelegate.Invoke(XmlWriterDelegator
xmlWriter, Object obj, XmlObjectSerializerWriteContext context,
ClassDataContract dataContract)
at
System.Runtime.Serialization.ClassDataContract.WriteXmlValue(XmlWriterDelegator
xmlWriter, Object obj, XmlObjectSerializerWriteContext context)
at
System.Runtime.Serialization.XmlObjectSerializerWriteContext.SerializeWithoutXsiType(DataContract
dataContract, XmlWriterDelegator xmlWriter, Object obj)
at
System.Runtime.Serialization.DataContractSerializer.InternalWriteObjectContent(XmlWriterDelegator
writer, Object graph)
at
System.Runtime.Serialization.DataContractSerializer.InternalWriteObject(XmlWriterDelegator
writer, Object graph)
at
System.Runtime.Serialization.XmlObjectSerializer.WriteObjectHandleExceptions(XmlWriterDelegator
writer, Object graph)
at
System.Runtime.Serialization.XmlObjectSerializer.WriteObject(XmlDictionaryWriter
writer, Object graph)
at
System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.SerializeParameterPart(XmlDictionaryWriter
writer, PartInfo part, Object graph)
at
System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.SerializeParameter(XmlDictionaryWriter
writer, PartInfo part, Object graph)
at
System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.SerializeParameters(XmlDictionaryWriter
writer, PartInfo[] parts, Object[] parameters)
at
System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.SerializeBody(XmlDictionaryWriter
writer, MessageVersion version, String action, MessageDescription
messageDescription, Object returnValue, Object[] parameters, Boolean
isRequest)
at
System.ServiceModel.Dispatcher.OperationFormatter.SerializeBodyContents(XmlDictionaryWriter
writer, MessageVersion version, Object[] parameters, Object returnValue,
Boolean isRequest)
at
System.ServiceModel.Dispatcher.OperationFormatter.OperationFormatterMessage.OperationFormatterBodyWriter.OnWriteBodyContents(XmlDictionaryWriter
writer)
at
System.ServiceModel.Channels.BodyWriter.WriteBodyContents(XmlDictionaryWriter
writer)
at
System.ServiceModel.Channels.BodyWriterMessage.OnWriteBodyContents(XmlDictionaryWriter
writer)
at
System.ServiceModel.Channels.Message.OnWriteMessage(XmlDictionaryWriter
writer)
at
System.ServiceModel.Channels.Message.WriteMessage(XmlDictionaryWriter
writer)
at
System.ServiceModel.Channels.TextMessageEncoderFactory.TextMessageEncoder.WriteMessage(Message
message, Stream stream)
at
System.ServiceModel.Channels.HttpOutput.WriteStreamedMessage(Message
message, Stream stream, TimeSpan timeout)
at System.ServiceModel.Channels.HttpOutput.Send(TimeSpan timeout)
at
System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.SendRequest(Message
message, TimeSpan timeout)
at System.ServiceModel.Channels.RequestChannel.Request(Message
message, TimeSpan timeout)
at
System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message,
TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.Call(String action,
Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[]
outs, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannel.Call(String action,
Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[]
outs)
at
System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage
methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage
message)
Exception rethrown at [0]:
at
System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage
reqMsg, IMessage retMsg)
at
System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&
msgData, Int32 type)
at Monica.Core.IDestination.ReceiveFile(FileCopyInfo file)
at Monica.Core.FileSourceService.CopyFile(String sourceFileName,
String remoteServer) in
I:\Projects\Protos\ProtoMonica\Monica.Core\FileSourceService.cs:line 53
at SyncInvokeCopyFile(Object , Object[] , Object[] )
at System.ServiceModel.Dispatcher.InvokeDelegate.Invoke(Object
target, Object[] inputs, Object[] outputs)
at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object
instance, Object[] inputs, Object[]& outputs)
at
System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc&
rpc)


"Arkady Frenkel" <arkadyf@hotmailxdotx.com> a écrit dans le message de news:
OnsR7KQ%23GHA.4268@TK2MSFTNGP02.phx.gbl...
> That because of "transfermode" attribute in config file ( look at
> http://windowssdk.msdn.microsoft.com...nsfermode.aspx )
> transferMode="Streamed"
>
> Arkady
>
> "Steve B." <steve_beauge@com.msn_swap_msn_and_com> wrote in message
> news:u7qGATN%23GHA.3344@TK2MSFTNGP03.phx.gbl...
>> Hi,
>>
>> In a previous post I've a problem with transfering file using
>> wshttpbinding.
>> An answer was to check the MS sample : WSStreamedHttpBinding in order to
>> allow using Stream in operation.
>>
>> However, and even with the help shipped with the sample, I don't
>> understand what in the WSStreamedHttpBinding sample allow to use stream,
>> there is no reference of the stream class in the code...
>>
>> Can someone explain why this binding sample allow transfert of stream ?
>>
>> Thanks,
>> Steve
>>

>
>



My System SpecsSystem Spec
Old 10-27-2006   #4 (permalink)
Steve B.


 
 

Re: WSStreamedHttpBinding : how does it works ?

Actually, the doit method wait an argument which is not directly a stream,
but a small class (with other property I've not pasted for lisibility :

public class FileCopyInfo

{

private Stream m_rawFile;

[DataMember]

public Stream RawFile

{

get { return m_rawFile; }

set { m_rawFile = value; }

}

}



If I change my code to pass a Stream object instead of the FileCopyInfo
object with stream, the server side is correctly called.

Is there any limitation on putting stream properties in a datacontract
marked class ?

Steve


"Steve B." <steve_beauge@com.msn_swap_msn_and_com> a écrit dans le message
de news: uRY$7tc%23GHA.3644@TK2MSFTNGP02.phx.gbl...
> I'm still having troubles to make it working.
> Since I'm in a P2P pattern, host application acts both as client and
> server.
> According one of your advise, I do not use the service reference dialog of
> VS, but instead, I use the channelfactory :
>
> ChannelFactory<IDestination> channelFactory = new
> ChannelFactory<IMyService
> >(

>
> new WSStreamedHttpBinding("StreamedBinding"),
>
> new EndpointAddress(remoteUri)
>
> );
>
>
> IMyService proxy = channelFactory.CreateChannel();
>
> proxy.DoIt(
>
> File.OpenRead(sourceFile)
>
> );
>
> The app.config of the host (which is a console application) has this
> configuration (only usefull lines are pasted) :
>
> <service behaviorConfiguration="FileDestinationServiceBehavior"
>
> name="MyService">
>
> <endpoint binding="wsStreamedHttpBinding"
> bindingConfiguration="StreamedBinding"
>
> contract="IMyService" />
>
> </service>
>
> ...
>
> <bindings>
>
> <wsStreamedHttpBinding>
>
> <binding name="StreamedBinding" transferMode="Streamed"
> securityMode="None"/>
>
> </wsStreamedHttpBinding>
>
> </bindings>
>
>
>
> However, when the application reach the DoIt method, it throws an
> exception saying the FileStream is not serializable... even if the
> transfertMode is set to Streamed.
>
>
>
> I'm quite lost in this quite simple prototype... What is wrong ?
>
> Thanks in advance,
>
> Steve
>
>
> System.Runtime.Serialization.InvalidDataContractException was unhandled by
> user code
> Message="Type 'System.IO.FileStream' cannot be serialized. Consider
> marking it with the DataContractAttribute attribute, and marking all of
> its members you want serialized with the DataMemberAttribute attribute."
> Source="mscorlib"
> StackTrace:
> Server stack trace:
> at
> System.Runtime.Serialization.DataContract.ThrowInvalidDataContractException(String
> message, Type type)
> at
> System.Runtime.Serialization.DataContract.CreateDataContract(Int32 id,
> RuntimeTypeHandle typeHandle, Type type)
> at
> System.Runtime.Serialization.DataContract.GetDataContractSkipValidation(Int32
> id, RuntimeTypeHandle typeHandle, Type type)
> at
> System.Runtime.Serialization.DataContract.GetDataContract(RuntimeTypeHandle
> typeHandle, Type type, SerializationMode mode)
> at
> System.Runtime.Serialization.XmlObjectSerializerContext.GetDataContract(RuntimeTypeHandle
> typeHandle, Type type)
> at
> System.Runtime.Serialization.XmlObjectSerializerWriteContext.SerializeWithXsiType(XmlWriterDelegator
> xmlWriter, Object obj, RuntimeTypeHandle objectTypeHandle, Type
> objectType, Int32 declaredTypeID, RuntimeTypeHandle declaredTypeHandle,
> Type declaredType)
> at
> System.Runtime.Serialization.XmlObjectSerializerWriteContext.InternalSerialize(XmlWriterDelegator
> xmlWriter, Object obj, Boolean isDeclaredType, Boolean writeXsiType, Int32
> declaredTypeID, RuntimeTypeHandle declaredTypeHandle)
> at
> System.Runtime.Serialization.XmlObjectSerializerWriteContext.InternalSerializeReference(XmlWriterDelegator
> xmlWriter, Object obj, Boolean isDeclaredType, Boolean writeXsiType, Int32
> declaredTypeID, RuntimeTypeHandle declaredTypeHandle)
> at WriteFileCopyInfoToXml(XmlWriterDelegator , Object ,
> XmlObjectSerializerWriteContext , ClassDataContract )
> at
> System.Runtime.Serialization.XmlFormatClassWriterDelegate.Invoke(XmlWriterDelegator
> xmlWriter, Object obj, XmlObjectSerializerWriteContext context,
> ClassDataContract dataContract)
> at
> System.Runtime.Serialization.ClassDataContract.WriteXmlValue(XmlWriterDelegator
> xmlWriter, Object obj, XmlObjectSerializerWriteContext context)
> at
> System.Runtime.Serialization.XmlObjectSerializerWriteContext.SerializeWithoutXsiType(DataContract
> dataContract, XmlWriterDelegator xmlWriter, Object obj)
> at
> System.Runtime.Serialization.DataContractSerializer.InternalWriteObjectContent(XmlWriterDelegator
> writer, Object graph)
> at
> System.Runtime.Serialization.DataContractSerializer.InternalWriteObject(XmlWriterDelegator
> writer, Object graph)
> at
> System.Runtime.Serialization.XmlObjectSerializer.WriteObjectHandleExceptions(XmlWriterDelegator
> writer, Object graph)
> at
> System.Runtime.Serialization.XmlObjectSerializer.WriteObject(XmlDictionaryWriter
> writer, Object graph)
> at
> System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.SerializeParameterPart(XmlDictionaryWriter
> writer, PartInfo part, Object graph)
> at
> System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.SerializeParameter(XmlDictionaryWriter
> writer, PartInfo part, Object graph)
> at
> System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.SerializeParameters(XmlDictionaryWriter
> writer, PartInfo[] parts, Object[] parameters)
> at
> System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.SerializeBody(XmlDictionaryWriter
> writer, MessageVersion version, String action, MessageDescription
> messageDescription, Object returnValue, Object[] parameters, Boolean
> isRequest)
> at
> System.ServiceModel.Dispatcher.OperationFormatter.SerializeBodyContents(XmlDictionaryWriter
> writer, MessageVersion version, Object[] parameters, Object returnValue,
> Boolean isRequest)
> at
> System.ServiceModel.Dispatcher.OperationFormatter.OperationFormatterMessage.OperationFormatterBodyWriter.OnWriteBodyContents(XmlDictionaryWriter
> writer)
> at
> System.ServiceModel.Channels.BodyWriter.WriteBodyContents(XmlDictionaryWriter
> writer)
> at
> System.ServiceModel.Channels.BodyWriterMessage.OnWriteBodyContents(XmlDictionaryWriter
> writer)
> at
> System.ServiceModel.Channels.Message.OnWriteMessage(XmlDictionaryWriter
> writer)
> at
> System.ServiceModel.Channels.Message.WriteMessage(XmlDictionaryWriter
> writer)
> at
> System.ServiceModel.Channels.TextMessageEncoderFactory.TextMessageEncoder.WriteMessage(Message
> message, Stream stream)
> at
> System.ServiceModel.Channels.HttpOutput.WriteStreamedMessage(Message
> message, Stream stream, TimeSpan timeout)
> at System.ServiceModel.Channels.HttpOutput.Send(TimeSpan timeout)
> at
> System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.SendRequest(Message
> message, TimeSpan timeout)
> at System.ServiceModel.Channels.RequestChannel.Request(Message
> message, TimeSpan timeout)
> at
> System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message
> message, TimeSpan timeout)
> at System.ServiceModel.Channels.ServiceChannel.Call(String action,
> Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[]
> outs, TimeSpan timeout)
> at System.ServiceModel.Channels.ServiceChannel.Call(String action,
> Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[]
> outs)
> at
> System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage
> methodCall, ProxyOperationRuntime operation)
> at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage
> message)
> Exception rethrown at [0]:
> at
> System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage
> reqMsg, IMessage retMsg)
> at
> System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&
> msgData, Int32 type)
> at Monica.Core.IDestination.ReceiveFile(FileCopyInfo file)
> at Monica.Core.FileSourceService.CopyFile(String sourceFileName,
> String remoteServer) in
> I:\Projects\Protos\ProtoMonica\Monica.Core\FileSourceService.cs:line 53
> at SyncInvokeCopyFile(Object , Object[] , Object[] )
> at System.ServiceModel.Dispatcher.InvokeDelegate.Invoke(Object
> target, Object[] inputs, Object[] outputs)
> at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object
> instance, Object[] inputs, Object[]& outputs)
> at
> System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc&
> rpc)
>
>
> "Arkady Frenkel" <arkadyf@hotmailxdotx.com> a écrit dans le message de
> news: OnsR7KQ%23GHA.4268@TK2MSFTNGP02.phx.gbl...
>> That because of "transfermode" attribute in config file ( look at
>> http://windowssdk.msdn.microsoft.com...nsfermode.aspx )
>> transferMode="Streamed"
>>
>> Arkady
>>
>> "Steve B." <steve_beauge@com.msn_swap_msn_and_com> wrote in message
>> news:u7qGATN%23GHA.3344@TK2MSFTNGP03.phx.gbl...
>>> Hi,
>>>
>>> In a previous post I've a problem with transfering file using
>>> wshttpbinding.
>>> An answer was to check the MS sample : WSStreamedHttpBinding in order to
>>> allow using Stream in operation.
>>>
>>> However, and even with the help shipped with the sample, I don't
>>> understand what in the WSStreamedHttpBinding sample allow to use stream,
>>> there is no reference of the stream class in the code...
>>>
>>> Can someone explain why this binding sample allow transfert of stream ?
>>>
>>> Thanks,
>>> Steve
>>>

>>
>>

>
>



My System SpecsSystem Spec
Old 10-29-2006   #5 (permalink)
Arkady Frenkel


 
 

Re: WSStreamedHttpBinding : how does it works ?

When you use stream , you stand that it stream of bytes only not
serializable class defined by DataContract. IMHO you can use both. Obviously
the data received, you can deserialize as you need
Arkady

"Steve B." <steve_beauge@com.msn_swap_msn_and_com> wrote in message
news:eFIme9c%23GHA.3860@TK2MSFTNGP02.phx.gbl...
> Actually, the doit method wait an argument which is not directly a stream,
> but a small class (with other property I've not pasted for lisibility :
>
> public class FileCopyInfo
>
> {
>
> private Stream m_rawFile;
>
> [DataMember]
>
> public Stream RawFile
>
> {
>
> get { return m_rawFile; }
>
> set { m_rawFile = value; }
>
> }
>
> }
>
>
>
> If I change my code to pass a Stream object instead of the FileCopyInfo
> object with stream, the server side is correctly called.
>
> Is there any limitation on putting stream properties in a datacontract
> marked class ?
>
> Steve
>
>
> "Steve B." <steve_beauge@com.msn_swap_msn_and_com> a écrit dans le message
> de news: uRY$7tc%23GHA.3644@TK2MSFTNGP02.phx.gbl...
>> I'm still having troubles to make it working.
>> Since I'm in a P2P pattern, host application acts both as client and
>> server.
>> According one of your advise, I do not use the service reference dialog
>> of VS, but instead, I use the channelfactory :
>>
>> ChannelFactory<IDestination> channelFactory = new
>> ChannelFactory<IMyService
>> >(

>>
>> new WSStreamedHttpBinding("StreamedBinding"),
>>
>> new EndpointAddress(remoteUri)
>>
>> );
>>
>>
>> IMyService proxy = channelFactory.CreateChannel();
>>
>> proxy.DoIt(
>>
>> File.OpenRead(sourceFile)
>>
>> );
>>
>> The app.config of the host (which is a console application) has this
>> configuration (only usefull lines are pasted) :
>>
>> <service behaviorConfiguration="FileDestinationServiceBehavior"
>>
>> name="MyService">
>>
>> <endpoint binding="wsStreamedHttpBinding"
>> bindingConfiguration="StreamedBinding"
>>
>> contract="IMyService" />
>>
>> </service>
>>
>> ...
>>
>> <bindings>
>>
>> <wsStreamedHttpBinding>
>>
>> <binding name="StreamedBinding" transferMode="Streamed"
>> securityMode="None"/>
>>
>> </wsStreamedHttpBinding>
>>
>> </bindings>
>>
>>
>>
>> However, when the application reach the DoIt method, it throws an
>> exception saying the FileStream is not serializable... even if the
>> transfertMode is set to Streamed.
>>
>>
>>
>> I'm quite lost in this quite simple prototype... What is wrong ?
>>
>> Thanks in advance,
>>
>> Steve
>>
>>
>> System.Runtime.Serialization.InvalidDataContractException was unhandled
>> by user code
>> Message="Type 'System.IO.FileStream' cannot be serialized. Consider
>> marking it with the DataContractAttribute attribute, and marking all of
>> its members you want serialized with the DataMemberAttribute attribute."
>> Source="mscorlib"
>> StackTrace:
>> Server stack trace:
>> at
>> System.Runtime.Serialization.DataContract.ThrowInvalidDataContractException(String
>> message, Type type)
>> at
>> System.Runtime.Serialization.DataContract.CreateDataContract(Int32 id,
>> RuntimeTypeHandle typeHandle, Type type)
>> at
>> System.Runtime.Serialization.DataContract.GetDataContractSkipValidation(Int32
>> id, RuntimeTypeHandle typeHandle, Type type)
>> at
>> System.Runtime.Serialization.DataContract.GetDataContract(RuntimeTypeHandle
>> typeHandle, Type type, SerializationMode mode)
>> at
>> System.Runtime.Serialization.XmlObjectSerializerContext.GetDataContract(RuntimeTypeHandle
>> typeHandle, Type type)
>> at
>> System.Runtime.Serialization.XmlObjectSerializerWriteContext.SerializeWithXsiType(XmlWriterDelegator
>> xmlWriter, Object obj, RuntimeTypeHandle objectTypeHandle, Type
>> objectType, Int32 declaredTypeID, RuntimeTypeHandle declaredTypeHandle,
>> Type declaredType)
>> at
>> System.Runtime.Serialization.XmlObjectSerializerWriteContext.InternalSerialize(XmlWriterDelegator
>> xmlWriter, Object obj, Boolean isDeclaredType, Boolean writeXsiType,
>> Int32 declaredTypeID, RuntimeTypeHandle declaredTypeHandle)
>> at
>> System.Runtime.Serialization.XmlObjectSerializerWriteContext.InternalSerializeReference(XmlWriterDelegator
>> xmlWriter, Object obj, Boolean isDeclaredType, Boolean writeXsiType,
>> Int32 declaredTypeID, RuntimeTypeHandle declaredTypeHandle)
>> at WriteFileCopyInfoToXml(XmlWriterDelegator , Object ,
>> XmlObjectSerializerWriteContext , ClassDataContract )
>> at
>> System.Runtime.Serialization.XmlFormatClassWriterDelegate.Invoke(XmlWriterDelegator
>> xmlWriter, Object obj, XmlObjectSerializerWriteContext context,
>> ClassDataContract dataContract)
>> at
>> System.Runtime.Serialization.ClassDataContract.WriteXmlValue(XmlWriterDelegator
>> xmlWriter, Object obj, XmlObjectSerializerWriteContext context)
>> at
>> System.Runtime.Serialization.XmlObjectSerializerWriteContext.SerializeWithoutXsiType(DataContract
>> dataContract, XmlWriterDelegator xmlWriter, Object obj)
>> at
>> System.Runtime.Serialization.DataContractSerializer.InternalWriteObjectContent(XmlWriterDelegator
>> writer, Object graph)
>> at
>> System.Runtime.Serialization.DataContractSerializer.InternalWriteObject(XmlWriterDelegator
>> writer, Object graph)
>> at
>> System.Runtime.Serialization.XmlObjectSerializer.WriteObjectHandleExceptions(XmlWriterDelegator
>> writer, Object graph)
>> at
>> System.Runtime.Serialization.XmlObjectSerializer.WriteObject(XmlDictionaryWriter
>> writer, Object graph)
>> at
>> System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.SerializeParameterPart(XmlDictionaryWriter
>> writer, PartInfo part, Object graph)
>> at
>> System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.SerializeParameter(XmlDictionaryWriter
>> writer, PartInfo part, Object graph)
>> at
>> System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.SerializeParameters(XmlDictionaryWriter
>> writer, PartInfo[] parts, Object[] parameters)
>> at
>> System.ServiceModel.Dispatcher.DataContractSerializerOperationFormatter.SerializeBody(XmlDictionaryWriter
>> writer, MessageVersion version, String action, MessageDescription
>> messageDescription, Object returnValue, Object[] parameters, Boolean
>> isRequest)
>> at
>> System.ServiceModel.Dispatcher.OperationFormatter.SerializeBodyContents(XmlDictionaryWriter
>> writer, MessageVersion version, Object[] parameters, Object returnValue,
>> Boolean isRequest)
>> at
>> System.ServiceModel.Dispatcher.OperationFormatter.OperationFormatterMessage.OperationFormatterBodyWriter.OnWriteBodyContents(XmlDictionaryWriter
>> writer)
>> at
>> System.ServiceModel.Channels.BodyWriter.WriteBodyContents(XmlDictionaryWriter
>> writer)
>> at
>> System.ServiceModel.Channels.BodyWriterMessage.OnWriteBodyContents(XmlDictionaryWriter
>> writer)
>> at
>> System.ServiceModel.Channels.Message.OnWriteMessage(XmlDictionaryWriter
>> writer)
>> at
>> System.ServiceModel.Channels.Message.WriteMessage(XmlDictionaryWriter
>> writer)
>> at
>> System.ServiceModel.Channels.TextMessageEncoderFactory.TextMessageEncoder.WriteMessage(Message
>> message, Stream stream)
>> at
>> System.ServiceModel.Channels.HttpOutput.WriteStreamedMessage(Message
>> message, Stream stream, TimeSpan timeout)
>> at System.ServiceModel.Channels.HttpOutput.Send(TimeSpan timeout)
>> at
>> System.ServiceModel.Channels.HttpChannelFactory.HttpRequestChannel.HttpChannelRequest.SendRequest(Message
>> message, TimeSpan timeout)
>> at System.ServiceModel.Channels.RequestChannel.Request(Message
>> message, TimeSpan timeout)
>> at
>> System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message
>> message, TimeSpan timeout)
>> at System.ServiceModel.Channels.ServiceChannel.Call(String action,
>> Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[]
>> outs, TimeSpan timeout)
>> at System.ServiceModel.Channels.ServiceChannel.Call(String action,
>> Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[]
>> outs)
>> at
>> System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage
>> methodCall, ProxyOperationRuntime operation)
>> at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage
>> message)
>> Exception rethrown at [0]:
>> at
>> System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage
>> reqMsg, IMessage retMsg)
>> at
>> System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&
>> msgData, Int32 type)
>> at Monica.Core.IDestination.ReceiveFile(FileCopyInfo file)
>> at Monica.Core.FileSourceService.CopyFile(String sourceFileName,
>> String remoteServer) in
>> I:\Projects\Protos\ProtoMonica\Monica.Core\FileSourceService.cs:line 53
>> at SyncInvokeCopyFile(Object , Object[] , Object[] )
>> at System.ServiceModel.Dispatcher.InvokeDelegate.Invoke(Object
>> target, Object[] inputs, Object[] outputs)
>> at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object
>> instance, Object[] inputs, Object[]& outputs)
>> at
>> System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc&
>> rpc)
>>
>>
>> "Arkady Frenkel" <arkadyf@hotmailxdotx.com> a écrit dans le message de
>> news: OnsR7KQ%23GHA.4268@TK2MSFTNGP02.phx.gbl...
>>> That because of "transfermode" attribute in config file ( look at
>>> http://windowssdk.msdn.microsoft.com...nsfermode.aspx )
>>> transferMode="Streamed"
>>>
>>> Arkady
>>>
>>> "Steve B." <steve_beauge@com.msn_swap_msn_and_com> wrote in message
>>> news:u7qGATN%23GHA.3344@TK2MSFTNGP03.phx.gbl...
>>>> Hi,
>>>>
>>>> In a previous post I've a problem with transfering file using
>>>> wshttpbinding.
>>>> An answer was to check the MS sample : WSStreamedHttpBinding in order
>>>> to allow using Stream in operation.
>>>>
>>>> However, and even with the help shipped with the sample, I don't
>>>> understand what in the WSStreamedHttpBinding sample allow to use
>>>> stream, there is no reference of the stream class in the code...
>>>>
>>>> Can someone explain why this binding sample allow transfert of stream ?
>>>>
>>>> Thanks,
>>>> Steve
>>>>
>>>
>>>

>>
>>

>
>



My System SpecsSystem Spec
 

Thread Tools


Similar Threads
Thread Forum
ms works Vista installation & setup
How to read Works 4 .wps files in Vista [Works 9?] Vista General
Works 8.5 in Vista: "Microsoft Works has stopped working" Vista General
Which SD works with sb..? Vista General
What Works and What Doesn't Vista General


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46