Viewing studio reports in MVC framework.
-
Did you enable the filter? I guess you use the full framework, so you should use
[EnableJsReport]
.
Does this example work for you?
https://github.com/jsreport/jsreport-dotnet-example-net-webapp
-
Yes, I updated my image to show I'm using [EnableJsReport()] and the example works for me.
-
Hm, did you register jsreport in the
BundleConfig.js
?
https://github.com/jsreport/jsreport-dotnet-example-net-webapp/blob/master/App_Start/FilterConfig.cs#L13I apologize for the issues, we are just building this up.
-
I didn't have the filter but added it to FilterConfig.cs in the RegisterGlobalFilters method but the issue remains.
I don't know what you mean about BundleConfig.js.
No need to apologize. I'm fine working through the issues. Thanks.
-
Ah, typo, I meant
FilterConfig.cs
.Hm, It should work if the
JsReportFilterAttribute
is in the filters collection.
Technically we add an object to theHttpContext.Items
here and then you read it here.Would you please share somewhere or email me your project so I can take a look?
-
Discovered that it is also required to add this line:
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
to Global.asax.cx for the decoration to work.
-
Ah ok, yes, this is normally done by the default VS template. Thanks for sharing it.
-
Hi Blaha, vbmark. I'm using the same example (cloned today from GitHub) and it runs perfectly in IISExpress but when using the local IIS instead I get an error in all actions (besides Index):
Server Error in '/NetWebApp' Application. Could not find file 'C:\WINDOWS\TEMP\jsreport-temp\meta642b8545-b701-4a29-940c-8f2c0a8cdf26'. 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.IO.FileNotFoundException: Could not find file 'C:\WINDOWS\TEMP\jsreport-temp\meta642b8545-b701-4a29-940c-8f2c0a8cdf26'. Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. Stack Trace: [FileNotFoundException: Could not find file 'C:\WINDOWS\TEMP\jsreport-temp\meta642b8545-b701-4a29-940c-8f2c0a8cdf26'.] System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) +1346 System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost) +1132 System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost) +146 System.IO.StreamReader..ctor(String path, Encoding encoding, Boolean detectEncodingFromByteOrderMarks, Int32 bufferSize, Boolean checkHost) +179 System.IO.File.InternalReadAllText(String path, Encoding encoding, Boolean checkHost) +84 jsreport.Local.Internal.<RenderAsync>d__10.MoveNext() +1444 System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +31 System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +62 System.Runtime.CompilerServices.ConfiguredTaskAwaiter.GetResult() +31 jsreport.MVC.<RenderReport>d__8.MoveNext() +696 [AggregateException: One or more errors occurred.] System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification) +4719080 jsreport.MVC.JsReportStream.Close() +451 System.Web.HttpWriter.FilterIntegrated(Boolean finalFiltering, IIS7WorkerRequest wr) +773 System.Web.HttpResponse.FilterOutput() +126 System.Web.CallFilterExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +61 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +97 Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.7.2103.2
Sure enough,
C:\Windows\temp\jsreport-temp
has no "meta<guid>" files but has several "req<guid>.json" files.
Any ideas on why it doesn't work in IIS? Or this scenario (run as utility) not supported in IIS?Thanks
-
We will look into it
-
Can you try to change the application pool identity to the LocalSystem?
Can you try to kill all node processes from task manager, recycle the app pool and try it again?
-
Yup, that solved the matter (the change of the built-in account; I had no orphan node processes). That'll probably ruffle some feathers with our sysadmins due to security concerns though... let's hope not. :/
Thanks :)
-
FYI I've finished the documentation, examples and also introduction video for the .NET jsreport sdk.
Everything can be found here
https://jsreport.net/learn/dotnet