TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Amit K
NA
3
5.8k
Getting rid of tcp channel error
Sep 15 2016 3:03 PM
I've a .Net client/server app in which am using tcp binding to communicate with the WCF service. If the client is idle for say about an hour or so and if it then re-invokes a method on the server, the client keeps throws following error:
System.ServiceModel.ProtocolException: This channel can no longer be used to send messages as the output session was auto-closed due to a server-initiated shutdown. Either disable auto-close by setting the DispatchRuntime.AutomaticInputSessionShutdown to false, or consider modifying the shutdown protocol with the remote server.
To get rid of this, I need to restart the client or the server as a quick fix.
For a longterm solution, am I supposed to use reliableSession in both client and server with timeout as say 20 hours?
<reliableSession enabled="true" inactivityTimeout="00:20:00" />
client:
<system.serviceModel>
<bindings>
<netTcpBinding>
<binding name="NetTcpBinding_ITestInterface" />
</netTcpBinding>
</bindings>
<client>
<endpoint address="net.tcp://localhost:8733/MyService.ITestInterface/MyService/" binding="netTcpBinding" bindingConfiguration="NetTcpBinding_MyService" contract="MyService.TestInterface" name="NetTcpBinding_ITestInterface">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
</client>
</system.serviceModel>
server:
<system.serviceModel>
<bindings>
<netTcpBinding>
<binding name="NetTcpBinding_ITestInterface">
<security mode="None" />
</binding>
</bindings>
</system.serviceModel>
Or do I need to use DuplexChannelFactory when creating a proxy at the client side?
var proxy = new DuplexChannelFactory<AlarmServer>(context,
"NetTcpBinding_ITestInterface").CreateChannel()
Or is there any other more efficient way of getting rid of this error?
Thanks.
Reply
Answers (
1
)
Is this good practice to implement WCF Rest Service at DAL
Server to client communication using wcf service.