Configure no identity authentication for WCF

Source: Internet
Author: User

Server Configuration

<? Xml version = "1.0"?> <Configuration> <configSections> <section name = "MoreBusinessDatabase" type = "mccn. pureview. DBEntity. moreBusinessDatabaseSection, mccn. pureview. DBEntity, Version = 1.0.0.0, Culture = neutral, PublicKeyToken = 2f00005df9c822944 "/> </configSections> <system. web> <compilation debug = "true"/> </system. web> <! -- When deploying a service library project, you must add the configuration file content to the app. config file of the host. System. Configuration does not support database Configuration files. --> <System. serviceModel> <bindings> <strong> <binding name = "NoneSecurity" leading = "12000000" maxcompute edmessagesize = "12000000" useDefaultWebProxy = "false"> <readerQuotas maxStringContentLength = "12000000" maxArrayLength = ""12000000"/> <security mode = "None"/> </binding> </wsHttpBinding> </bindings> <services> <service name = "mccn. pureview. WCFBusinessService. pureviewService "> <endpoint Ddress = "" binding = "wsHttpBinding" bindingConfiguration = "NoneSecurity" contract = "mccn. pureview. WCFBusinessService. IPureviewService "> <identity> <dns value =" localhost "/> </identity> </endpoint> <endpoint address =" mex "binding =" mexHttpBinding "contract =" IMetadataExchange" /> 

Where

<Bindings>
<WsHttpBinding>
<Binding name = "NoneSecurity" maxBufferPoolSize = "12000000" maxcompute edmessagesize = "12000000" useDefaultWebProxy = "false">
<ReaderQuotas maxStringContentLength = "12000000" maxArrayLength = "12000000"/>
<Security mode = "None"/>
</Binding>
</WsHttpBinding>
</Bindings>

The key is to define the binding without security verification.

The red text below indicates that the end point binding does not require security verification.

<Endpoint address = "" binding = "wsHttpBinding" bindingConfiguration = "NoneSecurity" contract = "mccn. Pureview. WCFBusinessService. IPureviewService">

 

Client Configuration:

 

><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup><system.serviceModel>        <bindings>            <wsHttpBinding>                <binding name="WSHttpBinding_IPureviewService" closeTimeout="00:01:00"                    openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"                    bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"                    maxBufferPoolSize="524288" maxReceivedMessageSize="65536"                    messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"                    allowCookies="false">                    <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"                        maxBytesPerRead="4096" maxNameTableCharCount="16384" />                    <reliableSession ordered="true" inactivityTimeout="00:10:00"                        enabled="false" />                    <security mode="None">                                           </security>                </binding>            </wsHttpBinding>        </bindings>        <client>          <!--http://erpdev.mccn.com.cn:8002/mccn.Pureview.WCFBusinessService.PureviewService.svc?wsdl-->          <!--address="http://localhost:8732/Design_Time_Addresses/mccn.Pureview.WCFBusinessService/Service1/"-->          <endpoint address="http://erpdev.mccn.com.cn:8002/mccn.Pureview.WCFBusinessService.PureviewService.svc"                binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_IPureviewService"                contract="ServiceClient.IPureviewService" name="WSHttpBinding_IPureviewService">                <identity>                    <dns value="localhost" />                </identity>            </endpoint>        </client>

 

<Security mode = "None"/> the client does not perform verification settings.

Error debugging:

Server error,

View failed end point verification exception messages in Event Viewer
  1. Click"Start"Menu, and select"Run ...".

  2. TypeEventvwrAnd then click"OK".

  3. In the Event Viewer window, click"Application".

  4. Double-click"Application"The newly added "System. ServiceModel 4.0.0.0" event under the "WebHost" category in the window allows you to view insecure endpoint messages.

Set, generate, and run examples
  1. Make sure that you have executed the one-time installation process for the Windows Communication Foundation example.

  2. To generate a solution for C # Or Visual Basic. NET, follow the instructions in the example of generating Windows Communication Foundation.

  3. To run the example using a standalone or cross-computer configuration, follow the instructions in the Running the Windows Communication Foundation Samples.

 

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.