Host WCF Service in IIS

Source: Internet
Author: User
Tags msmq

WCF Service It can be hosted on Windows Service, was, ExecutableProgramAnd IIS Medium , However IIS Is the most effective mechanism. Because IIS In Windows Has been well integrated, especially In IIS 7.0 Added many powerful modules. However In IIS 6.0 Only HTTP Not Supported TCP, MSMQ And other binding protocols. However In IIS 7.0. Here I will introduce you to the following: HTTP Bound WCF Service How to host In IIS 6.0 Medium WCF ServiceIt can be hosted onWindows Service, was,Executable programs andIISMedium,HoweverIISIs the most effective mechanism. BecauseIISInWindowsHas been well integrated, especiallyIn IIS 7.0Added many powerful modules. HoweverIn IIS 6.0OnlyHTTPNot SupportedTCP, MSMQAnd other binding protocols. HoweverIn IIS 7.0.

Here I will introduce you to the following:HTTPBoundWCF ServiceHow to hostIn IIS 6.0Medium:

Assume thatWCF ServiceWrite it, and compile its service implementation, service contract and data contract into twoDLL.

(1) in IIS 6.0 create a virtual directory and add a bin directory

(2) implement services, DLL Add to bin directory

(3)AddSVCFile,Example

<@ Servicehost Language = C # service = "simplewcfservice. studentservicev30" DEBUG = "false"> Link

WhereLanguageCan beC #, VB. NET, JScript.

(4)AddWeb. configFile, andSystem. servicemodelConfigureWCF services.

WCF servicesIs recommended for configurationMicrosoftThe Configuration tool provided. InVisual Studio, Right-clickWeb. configOrApp. configYou can see the following:

 

The configuration file for the example is as follows:

 

Note that the above does not configure the serviceAddress,Because inIISIn this mode of hostingSeviceCorrespondingSVCFile inIISThe access address inService.

Assume that my exampleWCFServiceSVCFile isStudentservicev30.svc, The virtual directory name isTestiishost,The port used is8888,So myWCFServiceAddressYesHttp: // localhost: 8888/Studentservicev30.svc

After completing the preceding steps, you canInternet Certificate EInputWCF ServiceTo check whether it is hosted.

If you have not tried this hosting method, you may wish to writeDemoExercise!

 

In addition, the attachment below is a tool I wrote.(Executable programs and instructions for use), Through ParsingWCF ServiceConfiguration File(App. configOrWeb. configAnd so on)Or service implementation(ImplementationServicecontractTheDLL)OfDLLTo automatically generate the corresponding serviceSVCFile.

Http://files.cnblogs.com/fuhongwei041/SVCFileGeneratorTool.rar

That's all. Thank you for your reading!

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.