Common Security Solutions for WCF (2)

Source: Internet
Author: User

Insecure Intranet clients and services

The following illustration describes a simple Windows Communication Foundation (WCF) service, which is developed to provide information about the secure private network to WCF applications. Security is not required in the following situations: low data importance, network security in essence, or security is provided at the underlying layer of the WCF infrastructure.


Features Description

Security Mode

None

Transmission

TCP

Bind

NetTcpBinding

Interoperability

Only WCF

Authentication

None

Integrity

None

Confidentiality

None

Service

The following code and configuration will run independently. Perform one of the following operations:

  • Use code instead of configuration to create an independent service.
  • Use the provided configuration to create the service, but do not define any endpoints.
Code

The following code demonstrates how to create an insecure endpoint:

Configuration

The following code uses the configuration to set the same endpoint:

<?xml version="1.0" encoding="utf-8"?><configuration>  <system.serviceModel>    <behaviors />    <services>      <service behaviorConfiguration=""                name="ServiceModel.Calculator">        <endpoint address="net.tcp://localhost:8008/Calculator"                   binding="netTcpBinding"                  bindingConfiguration="tcp_Unsecured"                   name="netTcp_ICalculator"                  contract="ServiceModel.ICalculator" />      </service>    </services>    <bindings>      <netTcpBinding>        <binding name="tcp_Unsecured">          <security mode="None" />        </binding>      </netTcpBinding>    </bindings>    <client />  </system.serviceModel></configuration>

Client

The following code and configuration should be run independently. Perform one of the following operations:

  • Use Code (and client code) to create an independent client.
  • Create a client that does not define any endpoints. Use the client constructor that uses the configuration name as the parameter. For example:
Code

The following code demonstrates a basic WCF client that uses the TCP protocol to access insecure endpoints.

Configuration

The following configuration Code applies to the client:

<?xml version="1.0" encoding="utf-8"?><configuration>  <system.serviceModel>    <bindings>      <netTcpBinding>        <binding name="NetTcpBinding_ICalculator" >          <security mode="None">          </security>        </binding>      </netTcpBinding>    </bindings>    <client>      <endpoint address="net.tcp://machineName:8008/Calculator "                binding="netTcpBinding"                 bindingConfiguration="NetTcpBinding_ICalculator"                contract="ICalculator"                 name="NetTcpBinding_ICalculator" />    </client>  </system.serviceModel></configuration>

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.