I am getting the below error while calling the loadpageInfo method, actually the the request from controller to wcf service is going and working fine. but the response throws the below erro.Anyone kindly advice me how o resolve this error
Server Error in '/IboxV5' Application.
--------------------------------------------------------------------------------
Encountered unexpected character '<'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Xml.XmlException: Encountered unexpected character '<'.
Source Error:
Line 61: factory.Endpoint.Behaviors.Add(behaviour);
Line 62: var proxy = factory.CreateChannel();
Line 63: var respo = proxy.LoadPageInfo(request);
Source File: d:\Development\IboxV5\IboxV5.Controllers\Report\ReportEngineController.cs Line: 63
Stack Trace:
[XmlException: Encountered unexpected character '<'.]
System.Xml.XmlExceptionHelper.ThrowXmlException(XmlDictionaryReader reader, XmlException exception) +287
System.Runtime.Serialization.Json.XmlJsonReader.ReadAttributes() +1890105
System.Runtime.Serialization.Json.XmlJsonReader.ReadNonExistentElementName(StringHandleConstStringType elementName) +96
System.Runtime.Serialization.Json.XmlJsonReader.Read() +1580
System.Xml.XmlBaseReader.IsStartElement() +52
System.Xml.XmlBaseReader.IsStartElement(XmlDictionaryString localName, XmlDictionaryString namespaceUri) +86
System.Runtime.Serialization.XmlReaderDelegator.IsStartElement(XmlDictionaryString localname, XmlDictionaryString ns) +36
System.Runtime.Serialization.XmlObjectSerializer.IsRootElement(XmlReaderDelegator reader, DataContract contract, XmlDictionaryString name, XmlDictionaryString ns) +50
System.Runtime.Serialization.Json.DataContractJsonSerializer.InternalIsStartObject(XmlReaderDelegator reader) +92
System.Runtime.Serialization.XmlObjectSerializer.IsStartObjectHandleExceptions(XmlReaderDelegator reader) +53
[SerializationException: There was an error checking start element of object of type PerpetuumSoft.Reporting.WebViewer.Model.LoadPageInfoResponse. Encountered unexpected character '<'.]
System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) +10614671
System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) +336
Report.PerpetuumReportService.IReportService.LoadPageInfo(LoadPageInfoRequest request) +0
Report.ReportEngineController.LoadPageInfo(LoadPageInfoRequest request) in d:\Development\IboxV5\IboxV5.Controllers\Report\ReportEngineController.cs:63
lambda_method(Closure , ControllerBase , Object[] ) +181
System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters) +14
System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters) +211
System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +27
System.Web.Mvc.Async.<>c__DisplayClass42.<BeginInvokeSynchronousActionMethod>b__41() +28
System.Web.Mvc.Async.<>c__DisplayClass8`1.<BeginSynchronous>b__7(IAsyncResult _) +10
System.Web.Mvc.Async.WrappedAsyncResult`1.End() +57
System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult) +48
System.Web.Mvc.Async.<>c__DisplayClass39.<BeginInvokeActionMethodWithFilters>b__33() +57
System.Web.Mvc.Async.<>c__DisplayClass4f.<InvokeActionMethodFilterAsynchronously>b__49() +223
System.Web.Mvc.Async.<>c__DisplayClass37.<BeginInvokeActionMethodWithFilters>b__36(IAsyncResult asyncResult) +10
System.Web.Mvc.Async.WrappedAsyncResult`1.End() +57
System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult asyncResult) +48
System.Web.Mvc.Async.<>c__DisplayClass2a.<BeginInvokeAction>b__20() +24
System.Web.Mvc.Async.<>c__DisplayClass25.<BeginInvokeAction>b__22(IAsyncResult asyncResult) +102
System.Web.Mvc.Async.WrappedAsyncResult`1.End() +57
System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +43
System.Web.Mvc.<>c__DisplayClass1d.<BeginExecuteCore>b__18(IAsyncResult asyncResult) +14
System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +23
System.Web.Mvc.Async.WrappedAsyncResult`1.End() +62
System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +57
System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +23
System.Web.Mvc.Async.WrappedAsyncResult`1.End() +62
System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +47
System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute(IAsyncResult asyncResult) +10
System.Web.Mvc.<>c__DisplayClass8.<BeginProcessRequest>b__3(IAsyncResult asyncResult) +25
System.Web.Mvc.Async.<>c__DisplayClass4.<MakeVoidDelegate>b__3(IAsyncResult ar) +23
System.Web.Mvc.Async.WrappedAsyncResult`1.End() +62
System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +47
System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +9
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +9629296
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.18034
Controller:
[HttpPost]
public JsonResult LoadPageInfo(LoadPageInfoRequest request)
{
var factory = new ChannelFactory<ireportservice>(new WebHttpBinding(), ServiceHelper.PerpetuumReportService);
WebHttpBehavior behaviour = new WebHttpBehavior();
behaviour.DefaultOutgoingRequestFormat = WebMessageFormat.Json;
behaviour.DefaultOutgoingResponseFormat = WebMessageFormat.Json;
behaviour.DefaultBodyStyle = System.ServiceModel.Web.WebMessageBodyStyle.WrappedRequest;
factory.Endpoint.Behaviors.Add(behaviour);
var proxy = factory.CreateChannel();
var respo = proxy.LoadPageInfo(request);
return Json(respo);
}
Service.cs
public LoadPageInfoResponse LoadPageInfo(LoadPageInfoRequest request)
{
return base.LoadPageInfo(request);
}