Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jsf-2/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 将流/文件流对象从MVC应用程序发送到WCF服务_C#_Asp.net Mvc_Wcf_Stream_Filestream - Fatal编程技术网

C# 将流/文件流对象从MVC应用程序发送到WCF服务

C# 将流/文件流对象从MVC应用程序发送到WCF服务,c#,asp.net-mvc,wcf,stream,filestream,C#,Asp.net Mvc,Wcf,Stream,Filestream,以下是我陷入困境的场景: 我想在客户端上传一个图像/视频,并将文件信息发送到服务,以便将其保存在某个服务器位置,并将文件的元数据保存在数据库中 我读到流对象不能用任何其他参数发送到服务,所以我创建了一个类,它有一个流对象和一个字符串属性要发送到服务器,然后,我尝试将该类发送到服务 但仍有以下错误消息: There was an error while trying to serialize parameter http://tempuri.org/:stream. The InnerExcept

以下是我陷入困境的场景:

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

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

但仍有以下错误消息:

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.

有谁能帮我解决这个问题。

你能修复你引用的文本吗:你已经按照代码完成了,它应该只是一个引用。此外,您还需要提供更多的代码,例如,您的类