Deploying WCF with IIS in. NET 4 is simple

Source: Internet
Author: User
Keywords So using IIS so that we
Tags behavior debug file iis name net service set

In. NET 3.5, we need to do this:

1. Add a helloservice.svc file, add the ServiceHost tag, and add the name of the WCF service implementation to the service, for example:

<%@ ServiceHost language= "C #" debug= "false" service= "CNBlogs.Service.Impl.HelloService"%>

2. Add a binding to the web.config/system.servicemodel/bindings/basichttpbinding.

3. Add a behavior to the web.config/system.servicemodel/behaviors/servicebehaviors.

4. Add a service to the web.config/system.servicemodel/services and:

A to set the Behaviorconfiguration property.

b to set the Name property.

5. Add a endpoint under service and:

A to set the binding property.

b to set the Name property.

c) Set the Contract property.

In. NET 4, we just do this:

Add the following two properties to the Web.config/system.servicemodel/servicehostingenvironment/serviceactivations:

<add relativeaddress= "Helloservice.svc" service= "CNBlogs.Service.Impl.HelloService"/>

Once configured, the WCF service can be invoked normally.

If you need to generate a client proxy through SvcUtil.exe, simply add it in servicebehaviors:

<behavior>
<servicemetadata httpgetenabled= "true"/>
</behavior>

Recommended reading: A Developer ' s Introduction to Windows communication Foundation 4

Related Article

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.