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
Click"Start"Menu, and select"Run ...".
TypeEventvwrAnd then click"OK".
In the Event Viewer window, click"Application".
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
Make sure that you have executed the one-time installation process for the Windows Communication Foundation example.
To generate a solution for C # Or Visual Basic. NET, follow the instructions in the example of generating Windows Communication Foundation.
To run the example using a standalone or cross-computer configuration, follow the instructions in the Running the Windows Communication Foundation Samples.