locked
Web Service from IIS gives error RRS feed

  • Question

  • User914066155 posted

    Hi lads,

    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.

    Thank you

     kranthi

    Monday, September 9, 2013 6:10 AM

Answers

  • User914066155 posted

    I fixed problem by myself , it was permission to the database for user logged in and made changes to in webservice

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, September 13, 2013 4:22 AM

All replies

  • User371383779 posted

    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?

    Monday, September 9, 2013 6:39 AM
  • User914066155 posted

    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.

    Monday, September 9, 2013 6:44 AM
  • User753101303 posted

    Hi,

    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).

    Monday, September 9, 2013 6:58 AM
  • User914066155 posted

    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

    Tuesday, September 10, 2013 1:56 AM
  • User794904726 posted

    Please check whether the connection is getting closed properly after each call. Its a good idea to close the connection in finally clause.

    Tuesday, September 10, 2013 3:02 AM
  • User260886948 posted

    Hi,

    Plase try to open the connection before Mycommand.ExecuteReader(), like this:

              myconnection.open();
              Mycommand.ExecuteReader();
             .............
             .............
              myconnection.close();
    

    Here are some similar threads, please try to refer to:

    http://stackoverflow.com/questions/9705637/executereader-requires-an-open-and-available-connection-the-connections-curren .
    http://stackoverflow.com/questions/839014/executereader-requires-an-open-and-available-connection-the-connections-curren .
    http://stackoverflow.com/questions/7878095/executereader-requires-an-open-and-available-connection-the-connections-curre .

    Best Regards.

    Wednesday, September 11, 2013 6:19 AM
  • User914066155 posted

    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

    Thank you

     kranthi

    Wednesday, September 11, 2013 9:42 AM
  • User914066155 posted

    I fixed problem by myself , it was permission to the database for user logged in and made changes to in webservice

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, September 13, 2013 4:22 AM