Web服务上传文件 [英] Web service uploading a file

查看:74
本文介绍了Web服务上传文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,这可能是一个非常笨拙的问题,但是我还是要问,因为我是这个新手:)...
我正在开发一个Web服务,客户端将使用该服务将文件上传到共享点服务器.我在开发服务器上对此进行测试时,Evrything正常运行,但是当我尝试从本地计算机上使用此服务时,出现找不到文件"异常.现在这是合乎逻辑的,因为该文件在开发服务器上不存在.现在,我该怎么做才能在其他与托管该服务的服务器不在同一网络中的机器上也能正常工作?

例如,当我运行服务区域设置(在开发服务器上)并输入文件的路径(c:\ test.pdf)时,文件将正常上传,但是当我从另一台计算机通过网络运行该服务时浏览器并提供驻留在该计算机上的本地文件的路径(c:\ localTest.pdf),服务将在开发服务器文件系统上搜索该文件.

那么问题是如何告诉Web服务从调用该服务的计算机中搜索文件?

希望这使我的问题更容易理解.

Hello, this is probably a very noobish question, but I''ll ask it anyway, becouse Im new at this :)...
Im developing a webservice that clients will use for uploading files to a share point server. Evrything works fine when Im testing this on the development server, but when I try to use this service from a local machine, I get a "file could not be found" exception. Now this is logical becouse this file does not exist on the dev server. Now what must I do so that this will work also on other machines, that are not eaven in the same network as the server that will host the service?

For example, when I run the service localy(on the dev server) and I input the path to the file(c:\test.pdf), the file is uploaded normaly, but when I run the service from another machine thrugh the web browser and provide the path for the local file residing on that machine (c:\localTest.pdf), service searches for the file on the dev server file system.

So the question is how to tell the web service to search the files from the machine that called the service?

Hope this makes my problem more readeble.

Thank you for your answer!

推荐答案

Web服务无法搜索本地计算机,这是不可能的.您的问题是您编写的代码假定服务器和客户端相同,显然情况并非如此.一个Web服务只能回答请求,它不能做任何主动的事情(例如要求某事),并且肯定看不到客户端计算机.
A web service cannot search the local machine, that''s not possible. Your issue is that you wrote code that assumed the server and client were the same, which is clearly not going to be the case. A web service can only answer requests, it cannot do anything proactive, like ask for something, and it sure cannot see the client machine.


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

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