使用.NET Remoting传输文件? [英] Use .NET Remoting to transfer a file?

查看:80
本文介绍了使用.NET Remoting传输文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用.NET远程处理在网站和Windows服务之间进行通信.他们俩生活在不同的机器上.我有一个静态定义的端口号,供所有请求和响应使用.

I'm using .NET remoting to communicate between a web site and a Windows service. They both live on different machines. I have a statically defined port number for use by all requests and responses.

我还使用这种机制将文件从网站传输到Windows服务盒.我正在将要流向远程服务的对象传递给Windows服务框.该Web框正在打开另一个看似随机的端口,以简化包含文件Stream的请求.

I also use this mechanism to transfer files from the web site to the Windows service box. I'm passing a Stream object in the object that is being remoted to the Windows service box. The web box is opening another, seemingly random, port to facilitate this request that includes the file Stream.

是否有一种方法可以指定此文件流应使用哪个端口?有人知道为什么它不想使用我定义的端口,而我的所有其他请求/响应都可以毫无问题地使用吗?

Is there a way to specify which port this file Stream should use? Anyone know why it doesn't want to use the port I have defined and that all my other requests/responses use with no problem?

我正在使用.NET Framework v2.

I'm using .NET Framework v2.

推荐答案

只需将您的流读入字节[],然后将其传递即可.碰到这种情况,我就是这么做的.

Just read your stream into a byte[] then pass that. Exactly what I did when came across this situation.

这篇关于使用.NET Remoting传输文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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