简体   繁体   English

通过WCF计划的文件传输

[英]Scheduled file transfer via WCF

For the scheduled part I will use Quartz.net but for the file transferring part I am completely lost. 对于计划的部分,我将使用Quartz.net,但是对于文件传输的部分,我将完全丢失。

I found many examples but not close to what I need. 我发现了很多例子,但并没有达到我的需要。 I want to use two WCF libraries (no graphical interface) hosted in IIS to transfer files, no more than one GB. 我想使用IIS中托管的两个WCF库(无图形界面)来传输文件,最大不超过1 GB。 I understand the code (most of it) but when it comes to the ABC (address, bindings, contracts) it gets complicated. 我理解代码(大部分),但是涉及到ABC(地址,绑定,合同)时,它变得很复杂。 Can anyone point me to the right direction? 谁能指出我正确的方向?

WCF is a powerful framework and flexible in terms of IPC. WCF是一个强大的框架,在IPC方面具有灵活性。 And that flexibility has accompanied of complexity as well ( may be for me when I was learning this stuff ). 灵活性也伴随着复杂性(当我学习这些东西时可能适合我)。

  1. Address - Where is the service? 地址-服务在哪里? It pertains to the location of your service just like URL. 就像URL一样,它与服务的位置有关。

Ex. 例如 http://localhost/YourServicePath/Service.svc http://localhost/YourServicePath/Service.svc

  1. Binding - How do I talk to the service? 绑定-如何与服务对话? This is quiet complicated because it involve protocols and security. 这很安静,因为它涉及协议和安全性。 Binding defines on how both client and server will communicate to each other. 绑定定义了客户端和服务器之间如何通信。 There are different types of bindings. 有不同类型的绑定。 Bindings can be done through configuration file and/or programmatically. 绑定可以通过配置文件和/或以编程方式完成。

Ex. 例如 BasicHttpBinding, WSHttpBinding ,WSDualHttpBinding , NetTcpBinding, WSFederationHttpBinding, NetNamedPipeBinding, NetMsmqBinding,NetPeerTcpBinding BasicHttpBinding,WSHttpBinding,WSDualHttpBinding,NetTcpBinding,WSFederationHttpBinding,NetNamedPipeBinding,NetMsmqBinding,NetPeerTcpBinding

<bindings>
      <wsHttpBinding>
        <binding name="wshttpbind"  allowCookies="true" closeTimeout="00:01:00" 
        receiveTimeout="00:01:00" />
      </wsHttpBinding>
  </bindings>
  1. Contracts - What can the service do for me? 合同-服务可以为我做什么? Contracts are all information exposed to both party that agrees to used for exchanging of message. 合同是双方均同意用于交换消息的所有信息。 It could be Data, Operation/Service/Methods or Message contract. 它可以是数据,操作/服务/方法或消息合同。

Ex. 例如 Service Contract, DataContract, Message Contract and Fault Contract. 服务合同,数据合同,消息合同和故障合同。

[ServiceContract]
public interface ICalculate
{
   [OperationContract]
   double Add( double a, double b);
   [OperationContract]
   double Subtract( double a, double b);
}

I suggest to you to read article about it first for you not to lost along your development. 我建议您先阅读有关它的文章 ,以免您在开发过程中迷路。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM