Open Closed

SaaS: “Test” connection string returns 415 Unsupported Media Type in WebAssembly mode #10934


User avatar
0
VMPProgramador created

In SaaS → Tenants → Actions → Connection strings, clicking Test next to the default connection string shows the error 415 Unsupported Media Type, even when the connection string is valid.

The problem happens when the application is running in WebAssembly mode, but not in server mode.

Steps to reproduce

1. Server mode —> works

  1. Open a private window and sign in to the application.
  2. Go to SaaS → Tenants → Actions → Connection strings.
  3. Uncheck Use the shared database and fill in a valid connection string.
  4. Click Test.
  5. Confirm that the test runs successfully.

2. WebAssembly mode —> fails

  1. In the same window, reload the page with F5.
  2. Repeat the test with the same connection string.
  3. Confirm that the error 415 Unsupported Media Type is shown.
Markdown supported.
Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)

1 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    Hi,

    In WebAssembly mode the request goes through your Blazor project, and that forwarding endpoint loses the connection string, so the HttpApi.Host returns 415.

    You can fix it in your Blazor project for now. Add this class:

    using System.Linq;
    using Microsoft.AspNetCore.Mvc;
    using Microsoft.AspNetCore.Mvc.ApplicationModels;
    using Microsoft.AspNetCore.Mvc.ModelBinding;
    using Microsoft.Extensions.Options;
    using Volo.Abp.AspNetCore.Mvc;
    using Volo.Abp.AspNetCore.Mvc.Conventions;
    using Volo.Abp.DependencyInjection;
    using Volo.Abp.Http.Client.ClientProxying;
    using Volo.Abp.Http.Client.StaticProxying;
    using Volo.Abp.Http.Client.Web.Conventions;
    using Volo.Abp.Http.ProxyScripting.Generators;
    
    [DisableConventionalRegistration]
    public class MyHttpClientProxyServiceConvention : AbpHttpClientProxyServiceConvention
    {
        public MyHttpClientProxyServiceConvention(
            IOptions<AbpAspNetCoreMvcOptions> options,
            IConventionalRouteBuilder conventionalRouteBuilder,
            IClientProxyApiDescriptionFinder clientProxyApiDescriptionFinder,
            IOptions<AbpHttpClientStaticProxyingOptions> staticProxyingOptions)
            : base(options, conventionalRouteBuilder, clientProxyApiDescriptionFinder, staticProxyingOptions)
        {
        }
    
        protected override void ConfigureParameters(ControllerModel controller)
        {
            if (AbpHttpClientProxyHelper.IsClientProxyService(controller.ControllerType))
            {
                foreach (var action in controller.Actions)
                {
                    var actionApiDescription = FindActionApiDescriptionModel(controller, action);
                    if (actionApiDescription == null)
                    {
                        continue;
                    }
    
                    foreach (var parameter in action.Parameters.Where(p => p.BindingInfo == null))
                    {
                        if (actionApiDescription.Parameters.Any(p =>
                                p.NameOnMethod == parameter.ParameterName &&
                                p.BindingSourceId == ParameterBindingSources.Body))
                        {
                            parameter.BindingInfo = BindingInfo.GetBindingInfo(new[] { new FromBodyAttribute() });
                        }
                    }
                }
            }
    
            base.ConfigureParameters(controller);
        }
    }
    

    Then register it in ConfigureServices of your ...BlazorModule:

    context.Services.Replace(ServiceDescriptor.Transient<IAbpServiceConvention, MyHttpClientProxyServiceConvention>());
    

    This needs using Microsoft.Extensions.DependencyInjection.Extensions; and using Volo.Abp.AspNetCore.Mvc.Conventions;.

    We'll fix this in the next patch version. Your ticket has been refunded.

    Thanks

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v10.8.0-preview. Updated on October 30, 2026, 06:34
1
ABP Assistant
🔐 You need to be logged in to use the chatbot. Please log in first.