[英]How can I create a WCF service that allows users to connect to my service through a web browser and upload a file?
I've created a Hello World WCF service that uses the ASP.NET Development Server - I launch the client which opens a page in my web browser, HelloWorldService.svc, then this triggers the command prompt to open and print out a Hello World message. 我已经创建了一个使用ASP.NET开发服务器的Hello World WCF服务-启动客户端,该客户端在Web浏览器HelloWorldService.svc中打开一个页面,然后触发命令提示符打开并打印出Hello World消息。
I don't fully understand this chain of action or how it's useful. 我不完全了解这一行动链或它的作用。
I'm trying to create a WCF service that acts as a server that allows users to connect to the server and perform a file upload - I will take this file and store it locally on my machine. 我正在尝试创建一个充当服务器的WCF服务,允许用户连接到服务器并执行文件上传-我将获取此文件并将其本地存储在我的计算机上。
For now, allowing this to work locally on only my PC is fine but I really don't know where to begin to accomplish this. 现在,只允许在我的PC上本地运行该功能就可以了,但是我真的不知道从哪里开始完成此操作。 Any advice would be appreciated.
任何意见,将不胜感激。
EDIT: I NEED to use WCF. 编辑:我需要使用WCF。 So please don't suggest alternative solutions.
因此,请不要提出其他解决方案。
WCF is arguably overkill. WCF可以说是矫kill过正。 Simplest case, just use the standrad .Net FileUpload control.
最简单的情况是,只需使用standrad .Net FileUpload控件即可。
Here are some examples: 这里有些例子:
http://asp.net-tutorials.com/controls/file-upload-control/ http://asp.net-tutorials.com/controls/file-upload-control/
Which leads to the question "When should I use WCF"? 导致出现“何时应使用WCF”的问题? Here are a couple of answers:
这里有几个答案:
http://forums.asp.net/t/1480028.aspx http://forums.asp.net/t/1480028.aspx
http://msdn.microsoft.com/en-us/library/cc512038.aspx http://msdn.microsoft.com/zh-CN/library/cc512038.aspx
http://forums.asp.net/t/1478962.aspx http://forums.asp.net/t/1478962.aspx
Finally, here are a couple of links that describe WCF-based file transfer services: 最后,这是描述基于WCF的文件传输服务的几个链接:
http://www.codeproject.com/Articles/166763/WCF-Streaming-Upload-Download-Files-Over-HTTP http://www.codeproject.com/Articles/166763/WCF-Streaming-Upload-Download-Files-Over-HTTP
http://code.msdn.microsoft.com/windowsdesktop/Upload-files-using-a-REST-13f16af2 http://code.msdn.microsoft.com/windowsdesktop/Upload-files-using-a-REST-13f16af2
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.