i have problem in getting transport security work.
i have 2 services (a & b) running in same server. service call service b perform task. without security, can communicate fine. when turn on transport security following settings:
- security mode = transport
- transportclientcredentialtype = windows
- protectionlevel = encryptandsign
i got error when service calls service b:
system.servicemodel.communicationexception: socket connection aborted. caused error processing message or receive timeout being exceeded remote host, or underlying network resource issue. local socket timeout '00:00:09.7810000'. ---> system.io.ioexception: read operation failed, see inner exception. ---> system.servicemodel.communicationexception: socket connection aborted. caused error processing message or receive timeout being exceeded remote host, or underlying network resource issue. local socket timeout '00:00:09.7810000'. ---> system.net.sockets.socketexception: existing connection forcibly closed remote host
i tried changing receive , send timeout 5 mins still same error same timeout duration. difference need wait out 5 minutes instead of 1 minute.
can provide insight what's cause , how resolve this?
attached configuration file both service:
servicea
<?xml version="1.0" encoding="utf-8"?> <configuration> <system.web> <compilation targetframework="4.5" debug="true" defaultlanguage="c#" /> </system.web> <system.servicemodel> <protocolmapping> <remove scheme="net.tcp" /> <add scheme="net.tcp" binding="nettcpbinding" bindingconfiguration="reliabletcp" /> </protocolmapping> <client/> <behaviors> <servicebehaviors> <behavior name="mextag"> <servicemetadata httpgetenabled="false" /> <servicedebug includeexceptiondetailinfaults="false" /> </behavior> </servicebehaviors> <endpointbehaviors> <behavior name="trybehavior"> <datacontractserializer maxitemsinobjectgraph="2147483647" /> </behavior> </endpointbehaviors> </behaviors> <bindings> <custombinding> <binding name="mextcp"> <tcptransport portsharingenabled="true" /> </binding> </custombinding> <nettcpbinding> <binding name="reliabletcp" portsharingenabled="true" sendtimeout="00:05:00" receivetimeout="00:05:00" maxbufferpoolsize="2147483647" maxreceivedmessagesize="2147483647" maxbuffersize="2147483647"> <reliablesession enabled="true" /> <security mode="transport"> <transport clientcredentialtype="windows" protectionlevel="encryptandsign" /> </security> </binding> </nettcpbinding> </bindings> <services> <service behaviorconfiguration="mextag" name="test.service.serviceaimpl"> <endpoint address="net.tcp://app-svr:10010/servicea/serviceaimpl/" behaviorconfiguration="trybehavior" binding="nettcpbinding" bindingconfiguration="reliabletcp" contract="test.service.iservicea" /> <endpoint address="net.tcp://app-svr:10012/servicea/serviceaimpl/mex" binding="custombinding" bindingconfiguration="mextcp" contract="imetadataexchange" /> </service> </services> </system.servicemodel> <system.webserver> <modules runallmanagedmodulesforallrequests="true" /> <!-- browse web app root directory during debugging, set value below true. set false before deployment avoid disclosing web app folder information. --> <directorybrowse enabled="true" /> </system.webserver> </configuration>
serviceb
<?xml version="1.0" encoding="utf-8"?> <configuration> <system.web> <compilation targetframework="4.5" debug="true" defaultlanguage="c#" /> </system.web> <system.servicemodel> <client> <endpoint address="net.tcp://app-svr:10010/servicea/serviceaimpl/" binding="nettcpbinding" bindingconfiguration="nettcpbinding_iservicea" behaviorconfiguration="trybehavior" contract="serviceareference.iservicea" name="nettcpbinding_iservicea" /> </client> <behaviors> <servicebehaviors> <behavior name="mexget" > <!-- add following element service behavior configuration. --> <servicemetadata httpgetenabled="true" /> <servicedebug includeexceptiondetailinfaults="true" /> </behavior> </servicebehaviors> <endpointbehaviors> <behavior name="trybehavior"> <datacontractserializer maxitemsinobjectgraph="2147483647" /> </behavior> </endpointbehaviors> </behaviors> <bindings> <custombinding> <binding name="mextcp"> <tcptransport portsharingenabled="true" /> </binding> </custombinding> <nettcpbinding> <binding name="reliabletcp" portsharingenabled="true"> <reliablesession enabled="true" /> <security mode="transport"> <transport clientcredentialtype="windows" protectionlevel="encryptandsign" /> </security> </binding> <binding name="nettcpbinding_iservicea" receivetimeout="00:05:00" sendtimeout="00:05:00" maxbufferpoolsize="2147483647" maxreceivedmessagesize="2147483647" maxbuffersize="2147483647"> <reliablesession enabled="true" /> <security mode="transport"> <transport clientcredentialtype="windows" protectionlevel="encryptandsign" /> </security> </binding> </nettcpbinding> <mextcpbinding> <binding name="mextcp" /> </mextcpbinding> </bindings> <services> <service name="test.service.servicebimpl" behaviorconfiguration="mexget" > <endpoint address="mex" binding="custombinding" bindingconfiguration="mextcp" contract="imetadataexchange" /> <endpoint address="mex" binding="mexhttpbinding" contract="imetadataexchange" /> <endpoint address="net.tcp://app-svr:10010/serviceb/servicebimpl" binding="nettcpbinding" behaviorconfiguration="trybehavior" bindingconfiguration="reliabletcp" contract="test.service.serviceb" /> <host> <baseaddresses> <add baseaddress="http://app-svr:10011/serviceb/servicebimpl" /> <add baseaddress="net.tcp://app-svr:10010/serviceb/servicebimpl" /> </baseaddresses> </host> </service> </services> </system.servicemodel> <system.webserver> <modules runallmanagedmodulesforallrequests="true" /> <!-- browse web app root directory during debugging, set value below true. set false before deployment avoid disclosing web app folder information. --> <directorybrowse enabled="true" /> </system.webserver> </configuration>
there solution here ...you should try it...
added these behaviors @ both service , client config.
<behaviors> <endpointbehaviors> <behavior name="endpointbehavior"> <datacontractserializer maxitemsinobjectgraph="2147483647"/> </behavior> </endpointbehaviors> </behaviors>
update these values maximum size in both client , server config.
<binding name="tcpbinding" receivetimeout="00:15:00" sendtimeout="00:15:00" maxbufferpoolsize="2147483647" maxreceivedmessagesize="2147483647" maxbuffersize="2147483647"> <security mode="none"> <transport clientcredentialtype="none" protectionlevel="none" /> <message clientcredentialtype="none" /> </security> </binding>
hope helps.
Comments
Post a Comment