Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Error using Blazor server application

New Here ,
Dec 28, 2023 Dec 28, 2023

The following code works in a controller when I run it locally in a blazor server application.

Once I deploy the controller to a server that either uses anonymous or windows authentication an exception is thrown.

here is the code:

var pdfDocument = Directory.GetCurrentDirectory() + @"\WorkingDocuments\test.pdf";


Credentials credentials = Credentials.ServicePrincipalCredentialsBuilder()
.WithClientId("XXXXXXXXXXXXXXXX")
.WithClientSecret("XXXXXXXXXXXXXXXX")
.Build();

 


Adobe.PDFServicesSDK.ExecutionContext executionContext = Adobe.PDFServicesSDK.ExecutionContext.Create(credentials);
ExportPDFOperation pdfOperation = ExportPDFOperation.CreateNew(ExportPDFTargetFormat.DOCX);

FileRef sourceFileRef = FileRef.CreateFromLocalFile(pdfDocument);
pdfOperation.SetInput(sourceFileRef);

FileRef result = pdfOperation.Execute(executionContext);

The exception is as follows:

System.Exception: System.FormatException: Index (zero based) must be greater than or equal to zero and less than the size of the argument list.
at System.Text.ValueStringBuilder.AppendFormatHelper(IFormatProvider provider, String format, ReadOnlySpan`1 args)
at System.String.FormatHelper(IFormatProvider provider, String format, ReadOnlySpan`1 args)
at System.String.Format(String format, Object arg0)
at Adobe.PDFServicesSDK.core.http.HttpClient.CreateHttpBaseResponse[T](IRestResponse restResponse, HttpBaseRequest baseRequest)
at Adobe.PDFServicesSDK.core.http.HttpClient.ExecuteRequest[T](HttpBaseRequest baseRequest)
at Adobe.PDFServicesSDK.core.http.HttpClient.<>c__DisplayClass8_0`1.<Execute>b__0()
at Polly.Policy`1.<>c__DisplayClass11_0.<Execute>b__0(Context ctx, CancellationToken ct)
at Polly.Retry.RetryEngine.Implementation[TResult](Func`3 action, Context context, CancellationToken cancellationToken, ExceptionPredicates shouldRetryExceptionPredicates, ResultPredicates`1 shouldRetryResultPredicates, Action`4 onRetry, Int32 permittedRetryCount, IEnumerable`1 sleepDurationsEnumerable, Func`4 sleepDurationProvider)
at Polly.Retry.RetryPolicy`1.Implementation(Func`3 action, Context context, CancellationToken cancellationToken)
at Polly.Policy`1.Execute(Func`3 action, Context context, CancellationToken cancellationToken)
at Polly.Policy`1.Execute(Func`1 action)
at Adobe.PDFServicesSDK.core.http.HttpClient.Execute[T](HttpBaseRequest baseRequest)
at Adobe.PDFServicesSDK.core.auth.ServicePrincipalAuthenticator.RefreshSessionToken()
at Adobe.PDFServicesSDK.core.auth.ServicePrincipalAuthenticator.GetSessionToken()
at Adobe.PDFServicesSDK.core.http.HttpBaseRequest.Authenticate()
at Adobe.PDFServicesSDK.core.http.HttpClient.CreateRestRequest[T](HttpBaseRequest baseRequest)
at Adobe.PDFServicesSDK.core.http.HttpClient.ExecuteRequestAsync[T](HttpBaseRequest baseRequest)
at Adobe.PDFServicesSDK.core.storage.StorageAPI.<>c__DisplayClass0_0.<<CreateAssetUploadPreSignedURIs>b__0>d.MoveNext()
--- End of stack trace from previous location ---
at Adobe.PDFServicesSDK.core.storage.StorageAPI.CreateAssetUploadPreSignedURIs(InternalExecutionContext context, List`1 assetUploadURIRequests, String requestID)
at Adobe.PDFServicesSDK.core.service.StorageService.UploadAssets(InternalExecutionContext context, List`1 sourceFileRefList, String requestID)
at Adobe.PDFServicesSDK.core.service.ExportPDFService.ExportPDF(InternalExecutionContext context, FileRefImpl sourceFileRef, ExportPDFTargetFormat exportPDFTargetFormat, ExportPDFOptions exportPDFOptions, String operation, String temporaryDestinationPath)
at Adobe.PDFServicesSDK.pdfops.ExportPDFOperation.Execute(ExecutionContext context)
at ChemicalResearch.Web.Controllers.AdobeController.Convert(String fileName) in C:\TFS\repos\ChemicalResearch\ChemicalResearch.Web\Controllers\AdobeController.cs:line 66
at ChemicalResearch.Web.Controllers.AdobeController.Convert(String fileName) in C:\TFS\repos\ChemicalResearch\ChemicalResearch.Web\Controllers\AdobeController.cs:line 90
at lambda_method112(Closure, Object)
at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(ActionContext actionContext, 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()
--- End of stack trace from previous location ---
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResourceFilter>g__Awaited|25_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()
--- End of stack trace from previous location ---
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddlewareImpl.Invoke(HttpContext context)

HEADERS
=======
Authorization: Negotiate oXcwdaADCgEBoloEWE5UTE1TU1AAAwAAAAAAAABYAAAAAAAAAFgAAAAAAAAAWAAAAAAAAABYAAAAAAAAAFgAAAAAAAAAWAAAABXCiOIKAHxPAAAAD6YDfVnIKG3F6ByFDdWM9u2jEgQQAQAAAGDiZGnw/dWxAAAAAA==
Host: srpesd03.srp.gov:2900
traceparent: 00-ba80895adc12d643adf5d3f1da095fae-3855a7c0ad4f81fc-00






271
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
no replies

Have something to add?

Join the conversation
Resources