Activities of "Sturla"

Here it is but you can also try it out your self with the demo just as before (I had updated it to try to return the headers)

One more related question, how can I add custom header to the response?

This doesn't work in the controller Response.Headers.Add("BlobName", "content"); but I can still manipulate the response like with Response.ContentType = "THIS IS RETURNED!!"

public virtual async Task Save(IList<IRemoteStreamContent> UploadRecording) 
{
    try
    {
        Response.Headers.Add("CustomHeader", "someContent"); //<-- Isn´t returned!
        Response.ContentType = "THIS IS RETURNED!!"; //<-- BUT this is!
    }
    catch (Exception e)
    {
        Response.Clear();
        Response.StatusCode = 204;
        
        Response.HttpContext.Features.Get<IHttpResponseFeature>().ReasonPhrase = "File failed to upload";
        Response.HttpContext.Features.Get<IHttpResponseFeature>().ReasonPhrase = e.Message;
    }
}

Here in Blazor I'm trying to get the response back when successfully uploaded a file to the controller.

I'm just going after the Syncfusion example so there must be something else I need to do ?

Answer

I needed (I think) to add the following web.config to the HttpApi.Host project to increase upload size with the following config

<?xml version="1.0" encoding="utf-8"?>
<configuration>

  <!-- To customize the asp.net core module uncomment and edit the following section. 
  For more info see https://go.microsoft.com/fwlink/?linkid=838655 -->
  <!--
  <system.webServer>
    <handlers>
      <remove name="aspNetCore"/>
      <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule" resourceType="Unspecified"/>
    </handlers>
    <aspNetCore processPath="%LAUNCHER_PATH%" arguments="%LAUNCHER_ARGS%" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" />
  </system.webServer>
  -->
  <location path="Recording/recording-upload">
    <system.webServer>
      <security>
        <requestFiltering>
          <requestLimits maxAllowedContentLength="4096000" />
        </requestFiltering>
      </security>
    </system.webServer>
  </location>
</configuration>

And then I get this error when running the app with Azure Appservice

2021-12-21 13:54:57.472 +00:00 [ERR] Connection ID "17509995361417066312", Request ID "80007749-0002-f300-b63f-84710c7967bb": An unhandled exception was thrown by the application.
Volo.Abp.Http.Client.AbpRemoteCallException: Not Found
   at Volo.Abp.Http.Client.ClientProxying.ClientProxyBase`1.ThrowExceptionForResponseAsync(HttpResponseMessage response)
   at Volo.Abp.Http.Client.ClientProxying.ClientProxyBase`1.RequestAsync(ClientProxyRequestContext requestContext)
   at Volo.Abp.Http.Client.ClientProxying.ClientProxyBase`1.RequestAsync[T](ClientProxyRequestContext requestContext)
   at Volo.Abp.Http.Client.ClientProxying.ClientProxyBase`1.RequestAsync[T](String methodName, ClientProxyRequestTypeValue arguments)
   at Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ClientProxies.AbpApplicationConfigurationClientProxy.GetAsync()
   at Volo.Abp.AspNetCore.Mvc.Client.MvcCachedApplicationConfigurationClient.<GetAsync>b__14_0()
   at Volo.Abp.Caching.DistributedCache`2.GetOrAddAsync(TCacheKey key, Func`1 factory, Func`1 optionsFactory, Nullable`1 hideErrors, Boolean considerUow, CancellationToken token)
   at Volo.Abp.AspNetCore.Mvc.Client.MvcCachedApplicationConfigurationClient.GetAsync()
   at Volo.Abp.AspNetCore.Mvc.Client.RemoteLanguageProvider.GetLanguagesAsync()
   at Microsoft.AspNetCore.RequestLocalization.DefaultAbpRequestLocalizationOptionsProvider.GetLocalizationOptionsAsync()
   at Microsoft.AspNetCore.RequestLocalization.AbpRequestLocalizationMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
   at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.<>c__DisplayClass6_1.<<UseMiddlewareInterface>b__1>d.MoveNext()
--- End of stack trace from previous location ---
   at Microsoft.AspNetCore.Server.IIS.Core.IISHttpContextOfT`1.ProcessRequestAsync()

I haven't tried to upload a bigger file than 30 MB but if that doesn´t work without the web.config file I´ll need some way to add it. But I´ll try that tomorrow.

Thank you! I'll then use IRemoteStreamContent Now closing this

Ok ok that was not obvious so thank you so much!

But should I use IList<IFormFile> or IList<IRemoteStreamContent> because both work?

Is there any benefit for me using IList<IRemoteStreamContent> here?

Yes I have decided to go with Syncfusion (or at least try to get it to work) but am having issues with that and created this ticket here for that. So I'll close this one and hope you can help me with the other one (where IRemoteStreamContent is not solving my issue).

I have just updated my demo repo with the code for you to try out. Just F5 and upload file with Browse

Here is the Blazor code and here is the API that gets hit but is always empty (except with SwaggerUI).

Sorry that doesn't work. I have tried every mutation of that. I just don't understand that it works with SwaggerUI but not Blazor if there is no setting or something I need to configure...

For some reason I can't get data from Blazor to a controller but I can through SwaggerUI when using this Syncfusion File Upload component.

Looks like it works in Blazor (but doesn't)

When in Blazor it only looks like I successfully upload a file

when in reality 0 file data gets transferred with no errors anywhere.. (nb.I have tried all kinds of attributes and [FromForm] etc that I seen suggested around the internet)

Works in SwaggerUI

But it does WORK if I use the SwaggerUI

here you can see that I get content with using SwaggerUI

The question

What is going on here and what do I need to do to make this work?


  • ABP Framework version: v4.4.4
  • UI type: Blazor WASM
  • DB provider: EF Core
  • Identity Server Separated: yes

After trying things out and searching the internet for answers I found out that Blazor WASM 5.0 does only support ~<2GB upload it seems. I asked this question here that will hopefully move me in the right direction.

But if all fails I will try out this Syncfusion large-file-chunk-upload. Isn't that something you should offer in the framework, large file upload?

How does the File Management Module deal with such large files?

Showing 161 to 170 of 210 entries
Made with ❤️ on ABP v9.0.0-preview Updated on September 19, 2024, 10:13