RadzenSSRSViewer: Authentication failed because the connection could not be reused

(I do understand that this may not be a supported situation but I thought I would ask)

If I create a fully working application, that connects to a password protected .rdl report in a SSRS server, using the Radzen Blazor application builder it works!

If I take the following code from that project:

image

...and put it in my project (that has all the same .net version, project settings, startup.cs, and program.cs, and nuget packages):

image

and use this tag on a .razor page:

<RadzenSSRSViewer ReportName="reports/FYIS_Transcipt" 
                  ReportServer="https://{{MY SERVER}}/ReportServer" 
                  style="height: 400px" 
                  UseProxy="true">
</RadzenSSRSViewer>

I get the following error:

image

System.Net.Http.HttpRequestException: Authentication failed because the connection could not be reused.
   at System.Net.Http.HttpConnection.DrainResponseAsync(HttpResponseMessage response)
   at System.Net.Http.AuthenticationHelper.SendWithNtAuthAsync(HttpRequestMessage request, Uri authUri, ICredentials credentials, Boolean isProxyAuth, HttpConnection connection, HttpConnectionPool connectionPool, CancellationToken cancellationToken)
   at System.Net.Http.HttpConnectionPool.SendWithNtConnectionAuthAsync(HttpConnection connection, HttpRequestMessage request, Boolean doRequestAuth, CancellationToken cancellationToken)
   at System.Net.Http.HttpConnectionPool.SendWithRetryAsync(HttpRequestMessage request, Boolean doRequestAuth, CancellationToken cancellationToken)
   at System.Net.Http.AuthenticationHelper.SendWithAuthAsync(HttpRequestMessage request, Uri authUri, ICredentials credentials, Boolean preAuthenticate, Boolean isProxyAuth, Boolean doRequestAuth, HttpConnectionPool pool, CancellationToken cancellationToken)
   at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
   at System.Net.Http.DecompressionHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
   at System.Net.Http.DiagnosticsHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
   at System.Net.Http.HttpClient.FinishSendAsyncBuffered(Task`1 sendTask, HttpRequestMessage request, CancellationTokenSource cts, Boolean disposeCts)
   at RadzenClientSsrs.Controllers.ReportController.ForwardRequest(HttpClient httpClient, HttpRequest currentReqest, String url) in C:\Users\Michael\Documents\Visual Studio 2019\Projects\RadzenSSRSTest\Controllers\ReportController.cs:line 129
   at RadzenClientSsrs.Controllers.ReportController.Get(String url) in C:\Users\Michael\Documents\Visual Studio 2019\Projects\RadzenSSRSTest\Controllers\ReportController.cs:line 25
   at lambda_method(Closure , Object )
   at Microsoft.Extensions.Internal.ObjectMethodExecutorAwaitable.Awaiter.GetResult()
   at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeInnerFilterAsync>g__Awaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResourceFilter>g__Awaited|24_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeFilterPipelineAsync>g__Awaited|19_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
   at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
   at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)

I can provide my project if you want to look at it.

Again, I do understand if this is not a supported situation. However, I would be willing to Blog on this! :slight_smile:

Thank You

We have no idea what is causing that exception (also searching online doesn't bring up anything useful). However if you are positive that everything works in a Radzen Blazor application you can compare the Startup.cs with yours. Maybe some of the configurations there mitigate that error.

Understood, thanks.

This one is so weird, because the Radzen application builder creates a "normal .net Core project" so I am able to "open it up" and compare it "side-by-side" to a new project.

But, one works and the other doesn't :frowning:

If anyone else runs into this, a friend was able to find the answer.

In the ForwardRequest method in the ReportController.cs file, add this line before the return statement at the end of the method:

AppContext.SetSwitch("System.Net.Http.UseSocketsHttpHandler", false);