服务端配置
<?xml version="1.0" encoding="utf-8"?> <!-- 有关如何配置 ASP.NET 应用程序的详细信息,请访问 http://go.microsoft.com/fwlink/?LinkId=169433 --> <configuration> <connectionStrings> <add name="IOGS.Pacific.PeopleDaily.Wall.Bll.Properties.Settings.NewspaperDBConnectionString" connectionString="Data Source=devserver;Initial Catalog=NewspaperDB;Persist Security Info=True;User ID=sa;Password=password01!" providerName="System.Data.SqlClient" /> </connectionStrings> <system.web> <compilation debug="true" targetFramework="4.5" /> <httpRuntime targetFramework="4.5" maxRequestLength="1024000"/> </system.web> <system.serviceModel> <protocolMapping> <add scheme="tcp" binding="netTcpBinding"/> </protocolMapping> <services> <service name="IOGS.Pacific.PeopleDaily.Wall.Svc.UserSvc" behaviorConfiguration="defaultBehavior"> <endpoint address="" binding="netTcpBinding" bindingConfiguration="netTcpBindConfig" contract="IOGS.Pacific.PeopleDaily.Wall.Svc.IUserSvc"></endpoint> <endpoint address="mex" binding="mexTcpBinding" contract="IMetadataExchange" /> </service> </services> <bindings> <basicHttpBinding> <binding name="MyServiceBinding" closeTimeout="00:10:00" receiveTimeout="24:00:00" sendTimeout="00:20:00" maxBufferSize="2147483647" maxReceivedMessageSize="2147483647"> <security mode="Message"> <message clientCredentialType="Certificate"/> </security> </binding> </basicHttpBinding> <netTcpBinding> <binding name="netTcpBindConfig" closeTimeout="00:10:00" portSharingEnabled="true" openTimeout="00:10:00" receiveTimeout="00:05:00" sendTimeout="00:05:00" transactionFlow="false" transferMode="Buffered" maxReceivedMessageSize="2147483647" transactionProtocol="OleTransactions" maxBufferSize="2147483647" hostNameComparisonMode="StrongWildcard" listenBacklog="10"> <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" /> <reliableSession ordered="true" inactivityTimeout="00:01:00" enabled="false" /> <security mode="Message"> <transport ></transport> <message clientCredentialType="Certificate"/> </security> </binding> </netTcpBinding> </bindings> <behaviors> <serviceBehaviors> <behavior name="defaultBehavior"> <serviceMetadata httpGetEnabled="true"/> <serviceDebug includeExceptionDetailInFaults="true" /> <dataContractSerializer maxItemsInObjectGraph="2147483647"/> <serviceCredentials> <clientCertificate> <authentication certificateValidationMode="None" /> </clientCertificate> <serviceCertificate findValue="DevServer.IOGS.PeopleDaily.BQH" x509FindType="FindBySubjectName" storeLocation="LocalMachine" storeName="My"/> </serviceCredentials> </behavior> </serviceBehaviors> </behaviors> </system.serviceModel> </configuration>
客户端配置
<?xml version="1.0" encoding="utf-8" ?> <configuration> <startup> <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" /> </startup> <appSettings> <add key="PageNumberList" value="1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24"/> <add key="HasRegist" value="False" /> </appSettings> <system.serviceModel> <bindings> <netTcpBinding> <binding name="NetTcpBinding" closeTimeout="00:10:00" openTimeout="00:10:00" receiveTimeout="00:30:00" sendTimeout="00:30:00" maxReceivedMessageSize="2147483647"> <readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647" maxNameTableCharCount="2147483647" /> <security mode="Message"> <message clientCredentialType="Certificate" /> </security> </binding> </netTcpBinding> </bindings> <client> <endpoint address="net.tcp://devserver.itgoldenbridge.com:8008/Services/UserSvc.svc" binding="netTcpBinding" bindingConfiguration="NetTcpBinding" behaviorConfiguration="clientBehavior" contract="UserServiceReference.IUserSvc" name="NetTcpBinding_IUserSvc"> <identity> <certificate encodedValue="AwAAAAEAAAAUAAAAvw11dkBjMslMv0brP0GumC10nsxcJc5ARDJEQgtEPOtsL4ahDHzpnYc8j4fSPBxsZTxNngY=" /> </identity> </endpoint> </client> <behaviors> <endpointBehaviors> <behavior name="clientBehavior"> <clientCredentials> <clientCertificate findValue="Client.IOGS.PeopleDaily.BQH" storeName="My" storeLocation="LocalMachine" x509FindType="FindBySubjectName"/> <serviceCertificate> <authentication certificateValidationMode="None"/> </serviceCertificate> </clientCredentials> </behavior> </endpointBehaviors> </behaviors> </system.serviceModel> </configuration>