I have built up the wcf web service in visual studio express 2010. I am using Linq to Sql to manipulate with database. where as i am having the tables EmpMaster (primary key table)and EmpDetail (F key table) with relationship based on EmpID.
I deployed this web service locally as of now. and trying to access the Employee master data as well as detail data using Linq to sql Query in my web application. my web application is MVC based application. whereas Employee master data I can access in web app via web service. but it should load with employee details entries by default.as by default DeferredLoadingEnabled
is enabled. I can see the set of records in the web service while debugging web service. but while accessing emp detail list data in web application I am getting error. as
"the underlying connection was closed the connection was closed unexpectedly "
I added in client web config :
<binding name="BasicHttpBinding_IEmployeeManagerService" openTimeout="10:10:00" receiveTimeout="10:10:00" sendTimeout="10:10:00"
allowCookies="false" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
maxBufferSize="104857600" maxBufferPoolSize="104857600" maxReceivedMessageSize="104857600"
messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
useDefaultWebProxy="true">
<readerQuotas maxDepth="104857600" maxStringContentLength="104857600"
maxArrayLength="104857600" maxBytesPerRead="104857600" maxNameTableCharCount="104857600" />
</binding>
What should be the problem?
**`**Edited:**`**
Public Function GetEmployeeDetail(ByVal id As String) As EmployeeDetail Implements IEmployeeManagerService.GetEmployeeDetail
Dim _empDetail As New EmployeeDetail()
If Not id Is Nothing Then
_empDetail = _dbContext.EmployeeDetails.Where(Function(e) e.EmpId = id ).FirstOrDefault()
End If
Return _empDetail
End Function
wel..wel..wel.... Found the trick but cold not get answer. I removed the Mapping between EmpMaster and EmpDetail then regenerate the .dbml. working perfect every thing at least for this time. but as i tried in normal asp.net web service, I got serialization error for EmpMaster object. and error was saying Circular reference ... bla bla bla.. don't know why. as i checked in Database Context class there were nothing seems like that. then i tried by removing the mapping between both tables in sql server. sounds working for me. ... Second way is here