A transport-level error has occurred when sending the request to the server. RRS feed

  • Question

  • Hi,

    A transport-level error has occurred when sending the request to the server. (provider: TCP Provider, error: 0 - An existing connection was forcibly closed by the remote host.)

    I am using a direct connection from my Gridview to perform a huge database search. the stored procedure will take 10- 60 seconds to execute the query.


    What the problem i am facing is when the sp takes long time (more than 1 minutes), then when i try any other operation like calling another sp frm another page, i am getting the above specified error.


    Anybody can tell why is it happening?

    can i abort stop the query afer sometime? or can i catch any perticular exception for this and release all resources so that it should not hang?


    here my code snippet goes


    <asp:GridView ID="searchGV" runat="server" AllowPaging="True" AllowSorting="True"

    BorderColor="#999999" BorderStyle="None" CellPadding="3" Width="100%" AutoGenerateColumns="False" DataSourceID="searchObj" DataKeyNames="Recordnumber" OnDataBound="searchGV_DataBound" OnPageIndexChanged="searchGV_PageIndexChanged">

    <RowStyle CssClass="gridRow" />

    <PagerStyle HorizontalAlign="Center" BackColor="#999999" ForeColor="Black" />

    <HeaderStyle CssClass="gridHeader" />

    <AlternatingRowStyle CssClass="gridAlternateRow" />


    <asp:TemplateField HeaderText="All">


    <asp:CheckBox ID="chkid" AutoPostBack="true" OnCheckedChanged ="OnCheckChangedEvent" runat="server" />



    <asp:CheckBox ID="chkSelect" runat="server" />



    <asp:CheckBox ID="chkSelect" runat="server"/>


    <ControlStyle Height="18px" Width="15px" />

    <ItemStyle Width="5px" />


    <asp:BoundField DataField="Title" HeaderText="Title" SortExpression="Title">

    <ItemStyle Width="150px" />


    <asp:BoundField DataField="Artist" HeaderText="Artist(s)" SortExpression="Artist"/>

    <asp:BoundField DataField="Album" HeaderText="Album" SortExpression="Album"/>

    <asp:BoundField DataField="Writer" HeaderText="Writer(s)" SortExpression="Writer" ><ItemStyle Width="150px" /></asp:BoundField>

    <asp:BoundField DataField="ISRC" HeaderText="ISRC" SortExpression="ISRC" />

    <asp:BoundField DataField="UPC" HeaderText="UPC" SortExpression="UPC"/>

    <asp:BoundField DataField="PLineLabel" HeaderText="P-Line Label" SortExpression="PLineLabel" ><ItemStyle Width="100px" /></asp:BoundField>

    <asp:BoundField DataField="DistLabel" HeaderText="Distribution Label" SortExpression="DistLabel" >

    <ItemStyle Width="100px" />


    <asp:BoundField DataField="PublishInfo" HeaderText="Publisher(s)" SortExpression="PublishInfo" />

    <asp:BoundField DataField="Recordnumber" HeaderText="Record Number" SortExpression="Recordnumber" />

    <%-- <asp:BoundField DataField="UID" HeaderText="UID" Visible="false" />--%>




    with adapter

    <asp:SqlDataSource ID="searchObj" runat="server" SelectCommand="gsp_titleSearchResult" SelectCommandType="StoredProcedure" ConnectionString="<%$ ConnectionStrings:ConnStr %>">


    <asp:ControlParameter ControlID="HuserID" PropertyName="Value" Name="Userid" Type="String" Size="50" DefaultValue="" />

    <asp:ControlParameter ControlID="Htitle" PropertyName="Value" Name="title" Type="String" Size="50" DefaultValue=" " />

    <asp:ControlParameter ControlID="Hartist" PropertyName="Value" Name="artist" Type="String" Size="50" DefaultValue=" " />

    <asp:ControlParameter ControlID="Halbum" PropertyName="Value" Name="album" Type="String" Size="50" DefaultValue=" " />

    <asp:ControlParameter ControlID="Hwriter" PropertyName="Value" Name="writer" Type="String" Size="50" DefaultValue=" " />

    <asp:ControlParameter ControlID="Hisrc" PropertyName="Value" Name="isrc" Type="String" Size="50" DefaultValue=" " />

    <asp:ControlParameter ControlID="Hupc" PropertyName="Value" Name="upc" Type="String" Size="50" DefaultValue=" " />

    <asp:ControlParameter ControlID="Hpline" PropertyName="Value" Name="pline" Type="String" Size="50" DefaultValue=" " />

    <asp:ControlParameter ControlID="Hdist" PropertyName="Value" Name="distlabel" Type="String" Size="50" DefaultValue=" " />

    <asp:ControlParameter ControlID="Hpublish" PropertyName="Value" Name="publisher" Type="String" Size="50" DefaultValue=" " />

    <asp:ControlParameter ControlID="ReleaseID" PropertyName="Value" Name="Releaseid" Type="Int32" Size="50" DefaultValue="0" />

    <asp:ControlParameter ControlID="RecordLabelID" PropertyName="Value" Name="recordlabelid" Type="Int32" Size="50" DefaultValue="0" />

    <asp:ControlParameter ControlID="PublisherID" PropertyName="Value" Name="Publisherid" Type="Int32" Size="50" DefaultValue="0" />

    <asp:ControlParameter ControlID="ArtistID" PropertyName="Value" Name="Artistid" Type="Int32" Size="50" DefaultValue="0" />




    Advance thanks

    Anvar Sadath


    Thursday, September 27, 2007 7:32 AM

All replies

  • hi anvar

    Please send the connection sting if possible. U can set the timeout period of the connection string accordingly this will terminate the connection after the fix period.

    Take care


    Thursday, September 27, 2007 3:56 PM
  • thanks roy,


    I set sonnection timout property to 900. so it was taking long time.


    For an information to all :


    When i done this search  first time, as i mentioned above it was taking so long time. As per direct connection from Grid to DB it should not take such long time. Fortunately my search is working fine now. if you execute a stored procdure and if it takes long time but if you call this through geid direct connection, it is finishing within few seconds and passing those values to web server.

    can anybody tell based on what parameter and how much rows will it returns to web server?


    no clues why my sp not returned any data first time and grid was waiting such a long time and getting expired?





    Saturday, September 29, 2007 8:40 AM