This is a migrated thread and some comments may be shown as answers.

Randomly Error requesting viewer with the service String was not recognized as a valid DateTime

6 Answers 125 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Voraluck
Top achievements
Rank 1
Voraluck asked on 11 Nov 2020, 02:43 AM

Telerik Report in .net framework MVC show message 

Error requesting viewer with the service String was not recognized as a valid DateTime

randomly. sometime it occur and after refresh or enter it again the report can render

I open Console and developer tool in browser and get request from

/api/reports/clients (error 500)

after that I call the request with curl and it error happen randomly.

nothing change in application so I'm not sure it from library or not? thank you

6 Answers, 1 is accepted

Sort by
0
Eric R | Senior Technical Support Engineer
Telerik team
answered on 13 Nov 2020, 05:41 PM

Hi Voraluck,

Thank you for the information on the error. Although, it doesn't provide enough information to understand the scenario. The best way to check if the Reporting REST Service is working properly is to use the Get Available Document Formats endpoint. This can be accomplished by navigating to [http(s)://www.domain.com]/api/reports/formats in the browser.

If the formats endpoint returns the expected response, additional troubleshooting steps are available. Let me review them below. 

Troubleshooting

1. Enable a TraceListener in the ASP.NET MVC Application. This can be accomplished by adding the following code snippet to the application.

<system.diagnostics>
    <trace autoflush="true" indentsize="4">
        <listeners>
            <add name="myListener" type="System.Diagnostics.TextWriterTraceListener" initializeData="Telerik.Reporting.log" />
            <remove name="Default" />
        </listeners>
    </trace>
</system.diagnostics>

2. Uses Fiddler to listen to requests and export the sessions that produce a 500 response. To export the sessions, follow the Create a Session Archive Zip (SAZ) article.

Wrapping Up

The above items should produce more details about the error. If it does not, I will need more details about the issue. For example, the Report Viewer Initialization code and the Reporting REST Service code.

In the meantime, please let me know if you need any additional information. Thank you for using the Telerik Reporting forums.

Regards,


Eric R | Senior Technical Support Engineer
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

0
Voraluck
Top achievements
Rank 1
answered on 24 Nov 2020, 11:57 AM
sorry but Fiddler to listen to requests should run on  client site or in the web server ? thank you
0
Voraluck
Top achievements
Rank 1
answered on 24 Nov 2020, 12:23 PM

this is from fiddler client call web

 

{
  "message": "An error has occurred.",
  "exceptionMessage": "String was not recognized as a valid DateTime.",
  "exceptionType": "System.FormatException",
  "stackTrace": "   at System.DateTimeParse.ParseExact(String s, String format, DateTimeFormatInfo dtfi, DateTimeStyles style)\r\n   at Telerik.Reporting.Services.Engine.PersistableObject.GetDateTime(String key)\r\n   at Telerik.Reporting.Services.Engine.ReportEngine.<>c__DisplayClass16.<CollectExpiredData>b__10(Client c)\r\n   at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()\r\n   at System.Linq.Buffer`1..ctor(IEnumerable`1 source)\r\n   at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)\r\n   at Telerik.Reporting.Services.Engine.ReportEngine.CollectExpiredData()\r\n   at Telerik.Reporting.Services.Engine.ReportEngine.RegisterClient()\r\n   at Telerik.Reporting.Services.WebApi.ReportsControllerBase.RegisterClient()\r\n   at lambda_method(Closure , Object , Object[] )\r\n   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass10.<GetExecutor>b__9(Object instance, Object[] methodParameters)\r\n   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary`2 arguments, CancellationToken cancellationToken)\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Controllers.ApiControllerActionInvoker.<InvokeActionAsyncCore>d__0.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Controllers.ActionFilterResult.<ExecuteAsync>d__2.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Controllers.ExceptionFilterResult.<ExecuteAsync>d__0.MoveNext()"
}

file from fiddler export

https://drive.google.com/file/d/1r5z0UehHdxR06L-1_uFf6WCXyNrc8z36/view?usp=sharing

0
Eric R | Senior Technical Support Engineer
Telerik team
answered on 24 Nov 2020, 08:21 PM

Hi Voraluck,

This appears to be pointing to the Cache of the Reporting REST Service. If using the FileStorage provider and specifying a folder, this folder can be deleted. 

If the issues persists after deleting the folder, I will need more information about the application. Are you able to provide the following items?

Please let me know if you are able to provide the above items. Thank you and I look forward to your reply.

Regards,


Eric R | Senior Technical Support Engineer
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

0
Voraluck
Top achievements
Rank 1
answered on 27 Nov 2020, 07:30 AM

here is report controller

public class ReportsController : ReportsControllerBase
    {
        static ReportServiceConfiguration _preservedConfiguration;

        static IReportServiceConfiguration PreservedConfiguration => _preservedConfiguration ?? 
            (_preservedConfiguration = new ReportServiceConfiguration
        {
            HostAppId = "MvcApp",
            Storage = new FileStorage(),
            ReportResolver = CreateResolver(),
            // ReportSharingTimeout = 0,
            // ClientSessionTimeout = 15,
        });

        static IReportResolver CreateResolver()
        {
            var reportsPath = HttpContext.Current.Server.MapPath("~/");

            return new ReportFileResolver(reportsPath)
                .AddFallbackResolver(new ReportTypeResolver());
        }

        public ReportsController()
        {
            //Initialize the service configuration
            ReportServiceConfiguration = PreservedConfiguration;
        }
    }

in .cshtml initialize the report

 

@(Html.TelerikReporting().ReportViewer()
             
              .Id("reportViewer1")
             
              .ServiceUrl(Url.Content("~/api/reports/"))
              .TemplateUrl(Url.Content("~/Templates/telerikReportViewerTemplate-FA-9.2.15.1105.html"))
              .ReportSource(typeReportSource)
              .ViewMode(ViewMode.PrintPreview)

 

 

 var typeReportSource = new TypeReportSource() { TypeName = typeof(THP.Welfare.Reporting.Reimbursement.WF_36Report).AssemblyQualifiedName };
   

0
Eric R | Senior Technical Support Engineer
Telerik team
answered on 27 Nov 2020, 08:48 PM

Hi Voraluck,

Thank you for providing the resources. It is great that they are implemented according to our recommendations. As a result, I spoke with the development team and they confirmed that this is likely a FileStorage issue.

For this case, we recommend moving the storage provide from File to MSSQL or Redis. Let me provide more information below to do this. 

Change Storage Provider

Both approaches require detailed steps, however, we do provide great documentation. See the following documentation links for reference.

Wrapping Up

Please give the above options a try and let me know if you need any additional information. Thank you for being a valued Telerik Reporting developer.

Regards,


Eric R | Senior Technical Support Engineer
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
General Discussions
Asked by
Voraluck
Top achievements
Rank 1
Answers by
Eric R | Senior Technical Support Engineer
Telerik team
Voraluck
Top achievements
Rank 1
Share this question
or