当远程服务器上存在服务和客户端时,如何上载本地文件以删除服务器。 [英] How to upload local file to remove server when both service and client exist on remote server.

查看:83
本文介绍了当远程服务器上存在服务和客户端时,如何上载本地文件以删除服务器。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,

我正在开发一个WCF服务,其中客户端和服务都存在于同一个远程服务器上,客户端通过浏览器从本地PC访问。该服务是WCF服务库,客户端是ASP.NET Web表单应用程序。我需要该服务来请求从用户的本地驱动器上传文件(例如C:/uploads/instructions.xlmx)。如果客户端在本地计算机上运行,​​那么这不是问题。但是因为客户端位于远程服务器上(对本地PC一无所知),我正在努力解决这个问题。这里要注意的一件事是,将文件从本地PC传输到远程服务器的指令将始终来自服务。



感谢我能得到的任何建议。请详细解释,因为我对此比较陌生。



问候

Pat



我尝试了什么:



我尝试在网上查找类似的方案 - 但没有成功。我的猜测是,不知怎的,我需要将文件上传到浏览器,但不知道我从

解决方案

我不知道你的意思。这里要注意的一件事是将文件从本地PC传输到远程服务器的指令总是来自服务......



网页用户需要选择要上传的文件 - 除非您说位置C中总会有一个文件:/uploads/instructions.xlmx需要上传。如果是这种情况,那么你需要另一种方法将文件发布到服务器,因为Web服务不能以这种方式工作。



如果你让用户访问通过ASP.Net页面上的FileUpload控件选择一个文件,然后可以将该文件作为字节数组发送到WCF服务。



亲切的问候

Hello,
I am developing a WCF service where both the client and the service exist on the same remote server and the client is accessed via a browser from uses local PC. The Service is a WCF Service Library and the client is a ASP.NET Web form application. I need the service to request that a file be uploaded from the user's Local drive (eg C:/uploads/instructions.xlmx). If the Client was running on the local machine then this would not be an issue. However because the client is on a remote server (which knows nothing about the Local PC) I am struggling with how I can go about this. The one thing to note here is that the instruction to transfer file from Local PC to remote server will always come from the service.

Appreciate any advise I can get on this. Please explain in detail as I am relatively new to this.

regards
Pat

What I have tried:

I have tried looking up similar scenarios on the web - without success. My guess is that somehow I need to upload file to the browser but not sure how of where I do this from

解决方案

I am not sure what you mean by ".. The one thing to note here is that the instruction to transfer file from Local PC to remote server will always come from the service..."

The Web Page user needs to select the file to be uploaded - unless you are saying "there will always be a file in location C:/uploads/instructions.xlmx that needs to be uploaded". If this is the case then you would need another method of posting the file to server as a web service doesn't work that way.

If you get the User to select a file via a FileUpload control on your ASP.Net page you can then get the file as a byte array which can be sent to your WCF service.

Kind Regards


这篇关于当远程服务器上存在服务和客户端时,如何上载本地文件以删除服务器。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆