tags:

views:

135

answers:

1

Hi,

I am working on an application where i am using a wcf service. I am currently hosting my service on localhost and accessing it from there only by adding the service reference in my project. On one of my page i am sending request on change of selected index on dropdown list. It works fine for first few requests but suddenly stops after that giving following excsption

"Failed to invoke the service. Possible causes: The service is offline or inaccessible; the client-side configuration does not match the proxy; the existing proxy is invalid. Refer to the stack trace for more detail. You can try to recover by starting a new proxy, restoring to default configuration, or refreshing the service."

How can service stop without any reason and that too from my localhost. It only works for first 3-4 requests. In service i am just sending a integer and getting back the records on its basis using a class in a generic list.

Thanks in advance

+1  A: 

What protocol / bindings are you using? Can you show us the config? Anything inside the <system.serviceModel> on both the server and the client side.

Do you maybe create a client proxy and call the service method and not properly close and dispose of the client proxy? In that case, you might run out of connections at some point - but that's next to impossible to tell without some code to see what you're doing. Can you show us the service contract in question, and the code how you call it from the client side?

marc_s
Following is from web.config in my project<binding name="WSHttpBinding_ICTP" closeTimeout="00:01:00" openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00" bypassProxyOnLocal="false" transactionFlow="false" hostNameComparisonMode="StrongWildcard" maxBufferPoolSize="524288" maxReceivedMessageSize="65536" messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true" allowCookies="false"> <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384" maxBytesPerRead="4096" maxNameTableCharCount="16384" />
pankaj
and this is from app.config in service <service behaviorConfiguration="RSPAService.CTPBehavior" name="RSPAService.CTP"> <endpoint address="" binding="wsHttpBinding" contract="RSPAService.ICTP"> <identity> <dns value="localhost" /> </identity> </endpoint> <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" /> <host> <baseAddresses> <add baseAddress="http://localhost:8731/Design_Time_Addresses/RSPAService/CTP/" /> </baseAddresses> </host> </service>
pankaj
i found the solution. I wasnot closing the call that i made to service. I just called Close() on the request that i made to service and now it works perfect.
pankaj
@pankaj: please do **NOT** put config and stuff like that into comments - add them to your original question by editing that! In the comments, there's no formatting and it makes reading this stuff next to impossible....
marc_s