简体   繁体   English

WAS使用net.tcp绑定托管WCF服务

[英]WAS hosting a WCF service with net.tcp binding

I'm trying to publish a calculation service on a bunch of computers which will be used by an application server. 我正在尝试在一堆将由应用程序服务器使用的计算机上发布计算服务。 The calculation servers are stateful and need to be able to perform asynchronous callbacks so I want to use per-session settings via TCP. 计算服务器是有状态的,需要能够执行异步回调,所以我想通过TCP使用每个会话设置。

The service application was built using the WCF Service Application project type in VS2008. 服务应用程序是使用VS2008中的WCF服务应用程序项目类型构建的。

As it happens the calculation service machines are running Vista, so according to the documentation I've read I should be able to use WAS hosting. 因为它发生了计算服务机器运行Vista,所以根据我读过的文档,我应该能够使用WAS托管。 I am trying to follow Microsoft's instructions on the subject: 我正在尝试遵循Microsoft关于此主题的说明:

Install and configure WCF components 安装和配置WCF组件

Host a WCF service in WAS 在WAS中托管WCF服务

But I am running into trouble early. 但是我很早就遇到了麻烦。 I am supposed to put the .svc file in my application's virtual directory. 我应该将.svc文件放在我的应用程序的虚拟目录中。 But since I am not using IIS hosting, how do I create the virtual directory? 但由于我不使用IIS主机,如何创建虚拟目录? The docs above are not clear on this. 上面的文档对此并不清楚。

Also, when trying to run the command which allows net.tcp access to my application: 此外,当尝试运行允许net.tcp访问我的应用程序的命令时:

%windir%\system32\inetsrv\appcmd.exe set app "Default Web Site/<WCF Application>" /enabledProtocols:net.tcp

I don't know what to replace <WCF Application> with. 我不知道用什么来替换<WCF Application> Again, there seems to be a prior step missing where one publishes the service in an 'IIS hosted-like' manner. 同样,似乎有一个先前的步骤缺少以“IIS托管式”方式发布服务的地方。

I've created a test application which tries to consume the service. 我创建了一个试图使用该服务的测试应用程序。 When I click "Add Service Reference" it discovers my service but can't connect to it using net.tcp. 当我单击“添加服务引用”时,它会发现我的服务但无法使用net.tcp连接到它。

Has anyone here succeeded in WAS hosting and consuming a service? 有没有人在这里成功进行WAS托管和服务? Do you have any pointers for me? 你有什么指示吗?

UPDATE: I've now tried to add net.tcp bindings to the website using IIS Manager (right click -> Edit bindings...) but the only protocols available in the Add... dialog are http and https. 更新:我现在尝试使用IIS管理器(右键单击 - >编辑绑定...)将net.tcp绑定添加到网站,但Add ...对话框中可用的唯一协议是http和https。 No net.tcp in that list. 该列表中没有net.tcp。 And yes, I have installed Non-http Activation components... Very strange. 是的,我已经安装了非http激活组件......非常奇怪。

Since WAS is part of the IIS architecture , you need to create a virtual directory in an IIS website (for example 'Default Web Site') that points to physical location of the WCF service you are hosting. 由于WASIIS体系结构的一部分,因此您需要在IIS 网站 (例如“默认网站”)中创建一个虚拟目录 ,该目录指向您托管的WCF服务的物理位置。 Then you will have to create an application on that virtual directory, like you would for an ASP.NET website, or an ASMX web service. 然后,您将必须在该虚拟目录上创建应用程序 ,就像在ASP.NET网站或ASMX Web服务上一样。
You can easily do this by using IIS 7's management console . 您可以使用IIS 7的管理控制台轻松完成此操作。

You can read the details about how WAS works in IIS7 here . 您可以在此处阅读有关WAS如何在IIS7中工作的详细信息
For a more step-by-step guide to WAS hosting have a look at this article . 有关WAS托管的更多分步指南,请查看本文

I had the same problem but got it to work. 我有同样的问题,但让它工作。 See this question. 看到这个问题。 Let me know if there is anything in the guidelines you need help wih how to do. 如果指南中有任何内容您需要帮助,请告诉我。

Setting up WCF TCP service in a web application 在Web应用程序中设置WCF TCP服务

You need to add the net.tcp binding to the binding of the application in IIS. 您需要将net.tcp绑定添加到IIS中应用程序的绑定。

Right click the virtual directory/application in IIS -> Manage application -> Advanced settings. 右键单击IIS中的虚拟目录/应用程序 - >管理应用程序 - >高级设置。

In the Enabled Protocols part just add net.tcp and voila!! 在Enabled Protocols部分中,只需添加net.tcp和voila !!

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

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