使用WCF在网站和Windows服务之间传递字符串 [英] using WCF to pass a string between a Website and a Windows Service

查看:54
本文介绍了使用WCF在网站和Windows服务之间传递字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


目标:我正在尝试将用户定义的消息从网站传递到在其他服务器上运行的Windows服务.

我刚刚被介绍给Windows Communication Foundation,这里有很多内容,因此,请您提供一些澄清和建议.但是,这似乎是在网站和Windows服务之间进行通信的最佳方式.我读过几篇有关WCF的文章,对某些事情有些困惑.基本上,似乎有两种不同的方法可以做到这一点.

一种方法似乎是在我的解决方案中创建一个新的WCF项目.

或者,您似乎所要做的就是添加< ServiceContract()>和< OperationContract()>标签添加到我现有Windows服务的类中,我可以从我的网站调用这些方法,就像它们是网站项目的一部分一样.

Hi all,


Objective: I am trying to pass a user defined message from a website to a windows service running on a different server.

I have just been introduced to Windows Communication Foundation and there is ALOT here to it, so I would appreciate some clarification and additionally some advice. However, this looks to be the best way to communicate between websites and windows services. I have been reading several different articles on WCF and I’m a little confused on something. Basically, it seems like there is two different ways to do this.

One method seems to be creating a new WCF item inside my solution.

Or another way seems like all you have to do is add the <ServiceContract()> and <OperationContract()> tags in the classes of my already existing windows service and I’m able to call these methods from my Website like they’re part of Website’s project.

Imports System.ServiceModel

<ServiceContract()> _
Public Class Test

<OperationContract()> _



我觉得那太简单了,我也没那么幸运.因此,我将假设选项一是我将继续进行的方式.有人可以确认吗?有人可以向我简要说明如何使用WCF项在网站和Windows服务之间中继消息吗?



I feel like that’s too easy and I’m not that lucky. So I’m going to assume that option one is how I’m going to have to proceed. Can anyone confirm this? And could anyone briefly explain to me how I could use this WCF item to relay messages between a Website and a Windows Service?

推荐答案

SMPT服务器,用于发送电子邮件.如果我没记错的话,应该在服务器站点页面上设置WCF,以及操作合同和服务合同.然后,您应该在您的网站位置中添加服务参考.

那就是我脑海中只能说的...
I have used this to communicate with a SMPT server, to send e-mails. If I remember correct, you should set up the WCF on you server site page, with the operation contract and service contract. Then you should add a service reference in you web site location.

Thats all I could say from the top of my head...


这篇关于使用WCF在网站和Windows服务之间传递字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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