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!