WCF is published to IIS 7.0 and is accessed with HTTPS

Source: Internet
Author: User

One, how to generate a server certificate in IIS 7.0, and require the Web site to be accessed in HTTP for reference:

Http://www.cnblogs.com/chnking/archive/2008/10/07/1305811.html

Make sure the certificate name is exactly the same as the server name.

Ii. WCF Application Authoring

1. "New Project"---WCF Service Application;

2. Modify the service interface and service class, generate;

3. If security is not taken into account, the client can call it if it is published directly here;

Third, WCF Service configuration Editor

1. Use the WCF Service Configuration Editor to open the program's web. config

2. Create a new "service":

(1) Select the generated ". dll"

(2) There are several modes of communication: TCP, HTTP, Named Pipes, MSMQ, peers (Point-to-point),

(3) The operation of basic Web services is not considered;

(4) Endpoint address (can not be filled, may need to look at this specific configuration later)

3. Create a new "binding":

(1) BasicHttpBinding

(2) Switch to "security"

(3) mode select "Transport" and then set the Transportclientcredentialtype in the Transportsecurity property to "none"

4. Service behavior in the advanced:

(1) Give a name: namespace. ServiceBehavior (not fixed, just think this writing is very normative);

(2) for "servicemetadata" meta data, set "Httpgetenabled=false,httpsgetenabled=true",

(3) Apply Service behavior settings, select the service set in step 2, "behaviorconfiguration" in the name set for (1), "bindingconfiguration" in the "endpoint" to

Select the name of the binding in step 3

5. Publish to WCF:

6. Test the WCF service with https:

The only thing to note is that localhost replaces the cost machine name

7. Build the client using Add Service reference or svcutil, provided that the Iis_user user has permission to the C:\Windows\Temp directory

8. After generating the client:

String url = "Https://myeggsoft/MyWcfService/DataService.svc";

BasicHttpBinding mybinding = new BasicHttpBinding ();            MyBinding.Security.Mode = Basichttpsecuritymode.transport;            MyBinding.Security.Transport.ClientCredentialType = Httpclientcredentialtype.none;            EndpointAddress address = new endpointaddress (URL); Servicereference1.dataserviceclient client = new Servicereference1.dataserviceclient (mybinding, address)

......

Note: This log was modified from: http://www.cnblogs.com/bearhb/archive/2012/07/02/2573236.html

WCF is published to IIS 7.0 and is accessed with HTTPS

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.