Last post Sep 13, 2013 04:22 AM by kranthipothireddy
Sep 09, 2013 06:10 AM|kranthipothireddy|LINK
i have web service which is hosed on IIS. When i run from iis i have am getting error "ExecuteReader requires an open and available Connection. The connection's current state is closed." But from application i debuged it which works fine and no error.
I cannot understand this weird behaviour. Could any one help with what causes this problem plz.
Sep 09, 2013 06:39 AM|Pankaj.Sharma|LINK
Could you show your code which is causing the problem. Without seeing the code it will be very difficult to say what could be the reason?
Sep 09, 2013 06:44 AM|kranthipothireddy|LINK
Hi thx for reply,
like i said there is no problem from application as i debug it, but the only prob is when i browse from IIS it gives the error i ve mentioned. i tried all possilites. But none worked for me.
Sep 09, 2013 06:58 AM|PatriceSc|LINK
It seems just that the connection is closed ? You could add some code to double check this is true and if true try to see where you closed the connection. Is this declared as a static member ? (in this case it is shared by all users so you could easily have
a request that closes the connection and trying to use this closed connection in some other http request).
Sep 10, 2013 01:56 AM|kranthipothireddy|LINK
just created this time wcf service with same database. it worked, but cannot figure where am getting wrong with actual app. it is not declared as static either. I checked permission for database thy are fine. any ideas
Sep 10, 2013 03:02 AM|Shiva Ammisetty|LINK
Please check whether the connection is getting closed properly after each call. Its a good idea to close the connection in finally clause.
Sep 11, 2013 06:19 AM|Amy Peng - MSFT|LINK
Plase try to open the connection before Mycommand.ExecuteReader(), like this:
Here are some similar threads, please try to refer to:
Sep 11, 2013 09:42 AM|kranthipothireddy|LINK
thx for reply,
but what i was trying to explain is that web service application from VS.net 2010 works fine and i can see data when i debug it. i have hosted web service on IIS and when i browse the web service, when i select a method now it throws error "ExecuteReader
requires an open and available Connection. this is my prob
Sep 13, 2013 04:22 AM|kranthipothireddy|LINK
I fixed problem by myself , it was permission to the database for user logged in and made changes to in webservice