I am getting following "The underlying connection was closed: The connection was closed unexpectedly." for a WCF service. I tried to find the solution on google, and most of the links said to modify the config. I did so, but still getting the same error
Client project files
default.aspx.cs
protected void Page_Load(object sender, EventArgs e)
{
try
{
AnnetInterviewQ.IQServiceClient obj = new AnnetInterviewQ.IQServiceClient();
reptInterviewQ.DataSource = obj.GetInterviewQ(2);
reptInterviewQ.DataBind();
}
catch (Exception ex)
{
throw ex;
}
}
default.aspx
<asp:Repeater ID="reptInterviewQ" runat="server" >
<ItemTemplate>
<%#Eval("IQId")%>
</ItemTemplate>
<ItemTemplate>
<%#Eval("IQ")%>
</ItemTemplate>
<ItemTemplate>
<asp:Repeater ID="reptInterviewOp" runat="server">
<ItemTemplate>
<%#Eval("IQOP")%>
</ItemTemplate>
</asp:Repeater>
</ItemTemplate>
</asp:Repeater>
web.config
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IIQService" closeTimeout="00:01:00"
openTimeout="00:01:00" receiveTimeout="00:10:00" sendTimeout="00:01:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="64" maxStringContentLength="2147483647" maxArrayLength="2147483647"
maxBytesPerRead="4096" maxNameTableCharCount="16384" />
<security mode="None">
<transport clientCredentialType="None" proxyCredentialType="None"
realm="" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<behaviors>
<endpointBehaviors>
<behavior name="debuggingBehaviour">
<dataContractSerializer maxItemsInObjectGraph="2147483646"/>
</behavior>
</endpointBehaviors>
</behaviors>
<client>
<endpoint address="http://localhost:2431/AnnetInterviewService.svc"
binding="basicHttpBinding" bindingConfiguration="BasicHttpBinding_IIQService"
contract="AnnetInterviewQ.IIQService" name="BasicHttpBinding_IIQService" />
</client>
WCF Service
WCFService.svc
public List<t_InterviewQ> GetInterviewQ(int yearsExprience)
{
InterViewQDataContext obj = new InterViewQDataContext();
var objIQList= from l in obj.GetTable<t_InterviewQ>()
where l.yearsofExpr==yearsExprience
select l;
return objIQList.ToList<t_InterviewQ>();
}
WCF service config
<connectionStrings>
<add name="TestConnectionString" connectionString="Data Source=Myserver;Initial Catalog=Test;Integrated Security=True"
providerName="System.Data.SqlClient" />
</connectionStrings>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior>
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="true"/>
<dataContractSerializer maxItemsInObjectGraph="2147483646" />
</behavior>
</serviceBehaviors>
</behaviors>
<serviceHostingEnvironment multipleSiteBindingsEnabled="true" />
</system.serviceModel>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
IService1.cs
[ServiceContract]
public interface IIQService
{
[OperationContract]
List<t_InterviewQ> GetInterviewQ(int yearsExprience);
}
Any suggestions..