Reputation: 1126
I firstly launched my subscriber for my WCF service and proceed to publish a posting from my publisher. My subscriber is able to receive the posting.
Secondly I closed my FIRST subscriber and open it again to subscribe to the same service which is so called the SECOND subscriber that has subscribed to the service. And once again, it is able to receive a posting.
Once I repeat this for the third time, there would be a exception of
The message could not be transferred within the allotted timeout of 00:01:00. There was no space available in the reliable channel's transfer window. The time allotted to this operation may have been a portion of a longer timeout.
Summary :
From what I have researched so far, I have seen that in this question, it mentioned that the default connection limit is 2?
Is that the issue that is causing my error? IF yes, is it possible to adjust the limit of the connection and how?
Pretty new in the WCF area and welcome anybody to give me their opinion. Thanks!
EDIT
Tried using UseSynchronizationContext = false on my client. As everytime a posting is sent, my PostReceived() method for my subscriber includes opening a popup windows form containing the information of the posting. When using UseSynchronizationContext = false, the windows form would not be able to open properly(an error here).
Anyone has any idea how to fix that or have any alternate solutions?
EDIT 2
Been reading around lots of WCF connection related stuffs and found out that most people are trying to toggle the maxConnections variable or related in their config files. My question is the only config files I have is in my client and none for my Service project. Is it necessary for me to add a config file for my service project?
As the "connection limit"(?) is 2, I tried the method of unsubcribing it when the client exits the application but that doesn't work and gives me and error. I have posted a question on the error that I received.
https://stackoverflow.com/questions/8395525/objectdisposedexception-on-wcf-service
Config Codes for Client side added :
<system.serviceModel>
<diagnostics performanceCounters="All" />
<bindings>
<wsDualHttpBinding>
<binding name="WSDualHttpBinding_IPostingContract" clientBaseAddress="http://localhost:8000/wcfClient/" closeTimeout="00:01:00"
openTimeout="00:10:00" receiveTimeout="00:10:00" sendTimeout="00:10:00"
bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard"
maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true">
<readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<reliableSession ordered="true" inactivityTimeout="00:10:00" />
<security mode="Message">
<message clientCredentialType="Windows" negotiateServiceCredential="true"
algorithmSuite="Default" />
</security>
</binding>
</wsDualHttpBinding>
</bindings>
<client>
<endpoint address="http://localhost:8888/PostingContract/Posting"
binding="wsDualHttpBinding" bindingConfiguration="WSDualHttpBinding_IPostingContract"
contract="IPostingContract" name="WSDualHttpBinding_IPostingContract">
<identity>
<userPrincipalName value="##" />
</identity>
</endpoint>
</client>
</system.serviceModel>
Would someone advise me if I have done anything wrong for my service part with regards to the behaviors or the config files. Appreciate a million. Thanks!
EDIT 3
Manage to play around with the service behavior. For the behavior, I changed the InstanceContextMode to single.
InstanceContextMode = InstanceContextMode.Single
and that actually allowed me to launch more than 2 connections of my windows form app. However if I do that, If I had launch 2 connections beforehand, for the third connection it will receive 3 popups, and subsequently for the forth connection, it will receive 4. When it is suppose to receive 1.
Upvotes: 3
Views: 3095
Reputation: 5223
would that help to add UseSynchronizationContext = false
on the client subscriber class
for e.g.
[CallbackBehavior(ConcurrencyMode = ConcurrencyMode.Reentrant,
UseSynchronizationContext = false)]
The reason might be of the dealocking callback similiar post here WCF: Having trouble with one-way callbacks
Upvotes: 3