如何将文件上传到 WCF 服务?

编程入门 行业动态 更新时间:2024-10-08 13:35:18
本文介绍了如何将文件上传到 WCF 服务?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时送ChatGPT账号..

我已经构建了一个 WCF 服务来接受一个文件并将其写入磁盘.前端由一个带有 SWFUpload 的页面组成,该页面在客户端处理上传.显然,SWFUpload 发布的数据的内容类型为:multipart/form-data.

I've build a WCF Service to accept a file and write it to disk. The front-end consists of a page with SWFUpload which is handling the upload on the client side. Apparently, SWFUpload posts the data with a Content Type of: multipart/form-data.

我认为这没问题,但在服务端我收到一个错误.错误是ProtocolException",需要 text/xml.我在绑定中尝试了不同的消息编码,但似乎没有任何效果.

I would think this ok but on the Service side I get an error. The error is "ProtocolException" expecting text/xml. I've tried different message encodings in the bindings but nothing seems to work.

如何使用 multipart/form-data 上传此文件?

How can I get this file uploaded using multipart/form-data?

推荐答案

@jdiaz,

@JasonS 是对的,要上传文件,您需要将其作为字节流传输.您需要使用 WCF 流式传输.例如,关于如何通过 WCF 上传文件,请参见 an文章来自http://kjellsj.blogspot

@JasonS is right, to upload file you need to transfer it as a byte stream. You need to use WCF streaming. For example on how to upload file via WCF see an article from http://kjellsj.blogspot

这篇关于如何将文件上传到 WCF 服务?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

更多推荐

[db:关键词]

本文发布于:2023-04-26 20:56:41,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1142693.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:如何将   文件上传   WCF

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!