WCF closing connection unexpected when the client expects data
I have a simple server/client setup using WCF. My problem is that any
method expecting a return value yields in an exception due to a
unexpectedly closed connection server
Conifguration file on server side
Configuratoin file on client side
All data classes are in an external project within the
MSO.ErrorSystem.Shared.Datatypes The code calling the method:
using (var client = Util.GetSearchServiceClient())
{
ViewBag.Results = client.SearchReports(searchTerm, page, 50);
}
Util.GetSearchServiceClient():
public static SearchServiceClient GetSearchServiceClient()
{
SearchServiceClient client = new SearchServiceClient();
client.ClientCredentials.Windows.AllowedImpersonationLevel =
System.Security.Principal.TokenImpersonationLevel.Impersonation;
return client;
}
The method called on server side:
public IEnumerable<Shared.Datatypes.Report> SearchReports(string
pSearchterm, int pPageNum, int pPageSize)
{
using (var session =
DatabaseManager.Instance.DocumentStore.OpenSession())
{
return session.Query<Report>().Where(r =>
Regex.IsMatch(r.Title, pSearchterm) || Regex.IsMatch(r.Text,
pSearchterm))
.OrderBy(r =>
r.Open).OrderBy(r =>
r.LastEdited).Skip(pPageNum *
pPageSize).Take(pPageSize);
}
}
No comments:
Post a Comment