Blazor(Wasm) RDLC Report runs under Net3.1, Net5, but gets permission exception under Net6 - reporting-services

I am following the instructions on this video: (https://www.youtube.com/watch?v=7V0Yb5drLgQ/)
It runs under .Net Core 3.1, .Net Core 5.0 perpectly.
but under NET6.0, it raises an exception:
System.IO.FileNotFoundException: "Could not load file or assembly 'System.Security.Permissions, Version=0.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. Das System kann die angegebene Datei nicht finden."
by code line:
LocalReport localReport = new LocalReport(path);
where path = $"{_webHostEnvironment.WebRootPath}\Reports\Report1.rdlc"
How to grant the Permissions of the path ...\wwwroot\Reports\ for LocalReport

Related

Why am I getting this error when deploying Blazor WASM App

I have an app that runs fine locally using VS 2022 and SQL Express. When I deploy I need to change to the production database in appsettings.json, which causes this error.
Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100]
Unhandled exception rendering component: net_http_message_not_success_statuscode, 500, Internal Server Error
System.Net.Http.HttpRequestException: net_http_message_not_success_statuscode, 500, Internal Server Error
at System.Net.Http.HttpResponseMessage.EnsureSuccessStatusCode()
at System.Net.Http.Json.HttpClientJsonExtensions.<GetFromJsonAsyncCore>d__29`1[[BlazorEcommerce.Shared.ServiceResponse`1[[System.Collections.Generic.List`1[[DataServicesTools.Shared.Models.CoreFile, DataServicesTools.Shared, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]], System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], DataServicesTools.Shared, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]].MoveNext()
at DataServicesTools.Client.Services.CoreFileService.CoreFileService.GetCoreFiles()
at DataServicesTools.Client.Pages.CoreFiles.Index.OnInitializedAsync()
at Microsoft.AspNetCore.Components.ComponentBase.RunInitAndSetParametersAsync()
at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(Task , ComponentState )
Connection strings I have tried. I left the password in case there are special characters that need to be escaped.
Server=servername;Database=database;Trusted_Connection=True;TrustServerCertificate=True;User Id=username;Password=M#sterM!nd;
Driver={ODBC Driver 17 for SQL Server};Server=servername;Database=database;Trusted_Connection=True;TrustServerCertificate=True;User Id=username;Password=M#sterM!nd;
This is the connection string that I'm using locally:
Server=servername;Database=database;Trusted_Connection=True;TrustServerCertificate=True

Could load file or assembly Microsoft.IdentityModel.Tokens.dll/Microsoft.IdentityModel.Tokens.Jwt.dll

This is killing me. I have cleared out the offending packages, uninstalled the packages, reinstalled, attempted to add a <PackageReference>, tried targeting multiple frameworks with <targetFrameworks>... All of the things and I am still getting this error at runtime.
I have a .NET Standard 2.0 library that is being consumed by a .NET Framework 4.8 project. The framework project does not reference any of the IdentityModel.Tokens/Jwt objects. I have manually copied the assembly from the packages location in to the bin folder of the offending project and it does not seem to change the result.
Fusion Log
*** Assembly Binder Log Entry (1/7/2021 # 11:38:12 AM) ***
The operation was successful.
Bind result: hr = 0x0. The operation completed successfully.
Assembly manager loaded from: C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
Running under executable REDACTED\REDACTED\bin\Debug\REDACTED.exe
--- A detailed error log follows.
=== Pre-bind state information ===
LOG: DisplayName = System.IdentityModel.Tokens.Jwt, Version=6.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
(Fully-specified)
LOG: Appbase = file: REDACTED
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = REDACTED.exe
Calling assembly : REDACTED.Shared, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: REDACTED\REDACTED\bin\Debug\REDACTED.exe.Config
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Post-policy reference: System.IdentityModel.Tokens.Jwt, Version=6.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
LOG: GAC Lookup was unsuccessful.
LOG: Attempting download of new URL file:///REDACTED/REDACTED/bin/Debug/System.IdentityModel.Tokens.Jwt.DLL.
LOG: Assembly download was successful. Attempting setup of file: REDACTED\REDACTED\bin\Debug\System.IdentityModel.Tokens.Jwt.dll
LOG: Entering run-from-source setup phase.
LOG: Assembly Name is: System.IdentityModel.Tokens.Jwt, Version=6.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
LOG: Binding succeeds. Returns assembly from REDACTED\REDACTED\bin\Debug\System.IdentityModel.Tokens.Jwt.dll.
LOG: Assembly is loaded in default load context.
After getting an additional set of eyes on it, it turns out that the root project file (we do things a little differently) that references the .NET Framework project requires a reference to the assembly that wasn't being loaded.
Don't know why, but maybe something to do with MVVM and using a root project as a wrapper/driver for the application.

Problem in running SSRS report using custom dll in SSRS 2016. Failed to grant permission to execute

When i am running the report, it is supposed to access a custom assembly (which is not signed), But i am getting the below error.
Failed to load expression host assembly. Details: Could not load file or assembly "xxxxxxx, Version=6.0.0.1, Culture=neutral, PublicKeyToken=null" or one of its dependencies. Failed to grant permission to execute. (Exception from HRESULT: 0x80131418) (rsErrorLoadingExprHostAssembly)
I have set FullTrust for the dll in RsSrvpolicy.config file.
The dll was compiled in .net framework 2.0.
OS: Windows 2016
SQL 2016

Allowing Javascript expressions in SSRS report

My problem is this: I'm trying to run javascript in certain expression in my report
This is what I have in my textbox:
=Code.test()
In my report properties I got the following code:
Function test() AS String
System.Web.HttpContext.Current.Response.Write("< script language='javascript' >alert('This is a test');< /script >")
return ""
End Function
When trying to deploy my reportserver I get the following error:
[rsRuntimeErrorInExpression] The Value expression for the textrun ‘Textbox4.Paragraphs[0].TextRuns[0]’ contains an error: That assembly does not allow partially trusted callers
I read on the following link that I have to give fulltrust to the assembly : https://social.msdn.microsoft.com/Forums/sqlserver/en-US/02f3d049-fc25-44c0-b03a-34820f75bfa7/couldnt-able-to-use-systemwebhttpcontextcurrentrequesturlabsoluteuri-in-c
Now, I assumed ( could be wrong) that the assembly I have to give fulltrust value to is this one: AspNetHostingPermission
So I added this to rssrvpolicy.config and rsmgrpolic.config
<CodeGroup
class="FirstMatchCodeGroup"
version="1"
PermissionSetName="FullTrust"
Description="This code group grants MyComputer code Execution permission. ">
<IMembershipCondition
class="AspNetHostingPermission"
version="1"
Zone="MyComputer" />
</CodeGroup>
However, when restarting my report server and trying to access localhost/reportserver I get this error:
library!DefaultDomain!3b38!02/14/2017-11:20:34:: e ERROR: Throwing
Microsoft.ReportingServices.Diagnostics.Utilities.ReportServerHttpRuntimeInternalException:
Failed to create HTTP Runtime,
Microsoft.ReportingServices.Diagnostics.Utilities.ReportServerHttpRuntimeInternalException:
An internal or system error occurred in the HTTP Runtime object for
application domain ReportServer_MSSQLSERVER_0. --->
System.Web.HttpException: Could not load file or assembly
'ReportingServicesWebServer, Version=12.0.0.0, Culture=neutral,
PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The
parameter is incorrect. (Exception from HRESULT: 0x80070057
(E_INVALIDARG)) (C:\Program Files\Microsoft SQL
Server\MSRS12.MSSQLSERVER\Reporting Services\ReportServer\web.config
line 14) ---> System.Configuration.ConfigurationErrorsException: Could
not load file or assembly 'ReportingServicesWebServer,
Version=12.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or
one of its dependencies. The parameter is incorrect. (Exception from
HRESULT: 0x80070057 (E_INVALIDARG)) (C:\Program Files\Microsoft SQL
Server\MSRS12.MSSQLSERVER\Reporting Services\ReportServer\web.config
line 14) ---> System.IO.FileLoadException: Could not load file or
assembly 'ReportingServicesWebServer, Version=12.0.0.0,
Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its
dependencies. The parameter is incorrect. (Exception from HRESULT:
0x80070057 (E_INVALIDARG)) File name: 'ReportingServicesWebServer,
Version=12.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91'
---> System.ArgumentException: Element must be a element. ---> System.ArgumentException: The
type does not implement IMembershipCondition
I'm assuming it's because of where I'm trying to add the codeGroup? I'm not very familiar with the file structure of those 2 configurations file. If someone more knowledgeable could point me in the right direction it would be awesome!
As a side note: I changed the other codegroup to Permission FullTrust just to see if it would change something ( without my extra piece of xml-code on top) but it didn't enable the javascript code more, it still gave me #error

VS 2013 Custom assemblies load Rdlc report

My external assemblies are not loading while i run report...
it does compile with no error but report could not run the error shows :
Error while loading code module: ‘ResultAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null’. Details: Could not load file or assembly 'ResultAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
In VS 2013
I have added my assembly in C:\Program Files (x86)\MSBuild\12.0\Bin.... it works fine when i compile my solution
But report not running :(