新人求教,WCF 从另一方收到未进行安全处理或安全处理不正确的错误。
Server端配置
程序代码:
<?xml version="1.0" encoding="utf-8" ?> <configuration> <system.web> <compilation debug="true" /> </system.web> <appSettings> <add key="BufferSize" value="4096" /> <add key="ConStringEncrypt" value="false" /> <add key="ConnectionString" value="Data Source=(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.2)(PORT = 1521))(CONNECT_DATA =(SERVICE_NAME = ORCL)));uid=reliableanalysis;pwd=reliableanalysis;" /> </appSettings> <system.serviceModel> <bindings> <wsHttpBinding> <binding name="WS_BlogBinding" closeTimeout="00:10:00" openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00" bypassProxyOnLocal="false" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" useDefaultWebProxy="true" allowCookies="false"> <readerQuotas maxDepth="32" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" /> <reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false" /> <security mode="Message"> <transport clientCredentialType="Windows" proxyCredentialType="None" realm="" /> <message clientCredentialType="Windows" negotiateServiceCredential="true" algorithmSuite="Default" /> </security> </binding> </wsHttpBinding> </bindings> <services> <service behaviorConfiguration="Com.PT.Server.Services.UserService" name="Com.PT.Server.Services.UserService"> <endpoint address="" binding="wsHttpBinding" bindingConfiguration="WS_BlogBinding" contract="Com.PT.Server.Services"> <identity> <dns value="TestCert" /> </identity> </endpoint> <endpoint address="" binding="wsHttpBinding" contract="IMetadataExchange" bindingConfiguration="WS_BlogBinding" /> </service> </services> <behaviors> <serviceBehaviors> <behavior name="http://127.0.0.1:8080/bindData/USER"> <serviceMetadata httpGetEnabled="true" /> <serviceDebug includeExceptionDetailInFaults="false" /> <serviceThrottling maxConcurrentCalls="10000" maxConcurrentInstances="10000" maxConcurrentSessions="10000"/> <dataContractSerializer maxItemsInObjectGraph="2147483647"/> </behavior> </serviceBehaviors> </behaviors> </system.serviceModel> </configuration>
Client端配置
程序代码:
<?xml version="1.0" encoding="utf-8" ?> <configuration> <system.serviceModel> <bindings> <wsHttpBinding> <binding name="WS_BlogBinding" closeTimeout="00:10:00" openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00" bypassProxyOnLocal="false" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" useDefaultWebProxy="true" allowCookies="false"> <readerQuotas maxDepth="32" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" /> <reliableSession ordered="true" inactivityTimeout="00:10:00" enabled="false" /> <security mode="Message"> <transport clientCredentialType="Windows" proxyCredentialType="None" realm="" /> <message clientCredentialType="Windows" negotiateServiceCredential="true" algorithmSuite="Default" /> </security> </binding> </wsHttpBinding> </bindings> <client> <endpoint address="http://127.0.0.1:8080/bindData/USER" binding="wsHttpBinding" bindingConfiguration="WS_BlogBinding" contract="SR_Server.KKXFX_Blog" name="WSHttpBinding_KKXFX_Blog" /> </client> </system.serviceModel> </configuration>