Iis7 host WCF Service supports the nettcp Protocol

Source: Internet
Author: User
Tags msmq
When using the iis7 host WCF Service, prepare to use the nettcp protocol supported by the legendary iis7, and encounter the following problems:

First question:
You can also add or modify the website binding directly through the IIS Manager: select the corresponding site => In the right section of "bindings" => In the displayed site bindings dialog box, you can add new site bindings and edit existing site bindings.The site bindings dialog box does not contain the net. TCP type.
You can run appcmd.exe set site to set the net. TCP type for this website, but it cannot be edited or deleted on iis7.

Second question:
After running appcmd.exe set app "localhost/myservice"/enabledprotocols: net. TCPProgramDisplayed after browsing:
HTTP Error 503.The service is unavailable.
Every time this happens, the iis7 host service cannot be connected;

Third question:
The client always throws an exception when calling the nettcp-based WCF interface:Unable to activate the requested service"Net. TCP: // localhost/washostingdemo/calculatorservice. SVC "....

The environment is Vista Business, vs2008 SP1, and was non-HTTP support is enabled.

Solution:
The first problem is solved after the SP1 package of Vista is installed., Binding can add any supported types.
The website cannot be started by default. After you press start, "Windows Process activation Service (was) and World Wide Web Publishing Service (W3SVC) are not started ..."
EnterNet start w3svcAnd press enter to start was and W3SVC at the same time. (TypeNet start wasW3SVC can be started separately)

Second question, Appcmd set app "localhost/myservice "/Enabledprotocols: HTTP, net. TCP, net. MSMQ
Use this command to add support protocols instead of incremental addition. You must enabled all the supported protocols!

Third question ,
Appears during solution New Question 1 : After several times of debugging, the following error occurs in the browser service after IIS host uses the wsdualhttp service:
Server Error in "myservice" Application -- unable to load DLL "mqrt. dll": the specified module cannot be found. (Exception from hresult: 0x8007007e)
New Problem 1 solved : Run appcmd set app "localhost/myservice"/enabledprotocols: HTTP, net. TCP After changing the application settings ( Net. MSMQ Protocol interface is not used currently ). It is estimated that the application pool crashes and needs to be restarted.

The problem is finally solved today! It turns out to be like this:
In non-iis host programs, due to a problem, the WCF bug seems to be (artech mentioned this in his blog: WCF Technology Analysis 6: Why is the baseaddress configured in the ASP. NET-based application hosting invalid? ), So in the endpoint of the service, we write as follows:
<Endpoint address = "net. TCP: // localhost/myservice" binding = "nettcpbinding" Contract = "myservice. imyservice"/>
However, baseaddress is invalid in IIS. IIS automatically adds the application site name as the prefix, that is, "net. TCP: // localhost/myservice ". Therefore, if we write the endpoint address in the configuration file in the WCF Service of IIS host again, the address is repeated, and the service cannot be correctly read.
The correct endpoint configuration for the iis host wcf Service is as follows:
<Endpoint address = "" binding = "nettcpbinding" Contract = "myservice. imyservice"/>


I finally called the iis7 host's WCF Service correctly! A little celebration...

2009.9.22 add new
In iis7,The website itself cannot be used by the host.NettcpProtocolWCF Service.If you want to use the hostwcf service, you must use an application hanging under the website and register the application to support the nettcp protocol.Which port used by nettcp, such as net. TCP 8008: * The Web client that calls the port. endpoint address = "net. TCP: // machinename: 8008/xxxservice/xxx. SVC"

In addition, codebehind = "app_code \ XXX. cs" or other service interface implementation must be specified in the SVC file.CodeFile.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.