WCF - WAS Hosting
WCF - WAS Hosting
?To understand the concept of WAS hosting, we need to comprehend how a system is configured and how a service contract is created, enabling different binding to the hosted service.
為了明白WAS托管的概念,我們需要理解一個系統(tǒng)是如何配置的,以及一個服務(wù)契約如何被創(chuàng)建的。確保托管服務(wù)可以接受不同的綁定
First of all, enable WCF for non-protocols. Before we start creating the service, we need to configure the system to support WAS. Following are the steps to configure WAS:
首先,確保wcf是無協(xié)議的。在我們開始創(chuàng)建服務(wù)之前,我們需要配置系統(tǒng)來支持WAS。配置WAS的步驟如下
-
Click Start Menu ? Control Panel ? Programs and Features, and click "Turn Windows Components On or Off" in the left pane.
-
Expand "Microsoft .Net Framework 3.0" and enable "Windows Communication Foundation HTTP Activation" and "Windows Communication Foundation Non- HTTP Activation".
-
Next, we need to add Binding to the default website. As an example, we will bind the default website to the TCP protocol. Go to Start Menu ? Programs ? Accessories. Right click on the "Command Prompt", and select "Run as administrator" from the context menu.
-
Execute the following command:
1.開始菜單-->控制面板-->程序和功能,打開或關(guān)閉windows功能。
2.展開.net3.0,啟用WCF?HTTP Activation和WCF?Non- HTTP Activation
3.需要給默認(rèn)的網(wǎng)站添加綁定,例如,我們可以給默認(rèn)的網(wǎng)站綁定TCP協(xié)議。以管理員權(quán)限啟動命令提示符
4.執(zhí)行以下命令
appcmd.exe set site "Default Web Site" -+bindings.[protocol='net.tcp',bindingInformation='808:*'] ? ? //吐槽下,這個命令執(zhí)行出錯了,我都不知道該怎么解決
This command adds the net.tcp site binding to the default website by modifying the applicationHost.config file located in the "C:\Windows\system32\inetsrv\config" directory. Similarly, we can add different protocols to the default website.
?
Create WAS Hosted Service
Step-1: Open Visual Studio 2008 and click New → WebSite and select WCF Service from the template and Location as HTTP, as shown below:
?
?
?
無力吐槽,后面的是IIS的差不多,關(guān)鍵是配置文件看不懂
轉(zhuǎn)載于:https://www.cnblogs.com/chucklu/p/4630133.html
總結(jié)
以上是生活随笔為你收集整理的WCF - WAS Hosting的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Python正则表达式-2
- 下一篇: Fuel 30 分钟快速安装OpenSt