将Stream / FileStream对象从MVC应用程序发送到WCF服务

时间:2015-01-06 09:18:43

标签: c# asp.net-mvc wcf stream filestream

这是我陷入困境的情景:

我想在客户端上传图像/视频并将文件信息发送到服务,以便将其保存在某个服务器位置,文件的元数据可以保存在数据库中。

我读到Stream对象不能用任何其他参数发送到服务,所以我创建了一个类,它有一个流对象和一个字符串属性要发送到服务器,然后,我试图将该类发送到服务。

但坚持这个错误信息:

There was an error while trying to serialize parameter http://tempuri.org/:stream. The InnerException message was 'Type 'System.IO.FileStream' with data contract name 'FileStream:http://schemas.datacontract.org/2004/07/System.IO' is not expected. Consider using a DataContractResolver or add any types not known statically to the list of known types - for example, by using the KnownTypeAttribute attribute or by adding them to the list of known types passed to DataContractSerializer.'.  Please see InnerException for more details.

任何人都可以帮助我。

0 个答案:

没有答案