proudmonkey/AutoWrapper

signalr error

mansai opened this issue · 6 comments

Failed to start the connection: Error: None of the transports

public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
app.UseSwagger();
app.UseSwaggerUI(c => c.SwaggerEndpoint("/swagger/v1/swagger.json", "Solution1.WebAPI v1"));
}

        app.UseHttpsRedirection();
        app.UseApiResponseAndExceptionWrapper();//Delete this line is ok
        app.UseRouting();

        app.UseCors("LimitRequests");

        app.UseAuthorization();

        app.UseEndpoints(endpoints =>
        {
            endpoints.MapControllers();
            endpoints.MapHub<ChatHub>("/api2/chathub");
        });
    }

image

image
image

Interesting. I haven't tried using AutoWrapper in combination of APIs and SignalR. Have you tried setting IsApiOnly to false and set the WrapWhenApiPathStartsWith options?

app.UseApiResponseAndExceptionWrapper(new AutoWrapperOptions { ShowStatusCode = true, IsApiOnly = false, BypassHTMLValidation = true, WrapWhenApiPathStartsWith = "/api2/chatHub/negotiate" });

is error
I custom a OptionBase:IgnorePath
app.UseApiResponseAndExceptionWrapper(new AutoWrapperOptions { ShowStatusCode = true, IsApiOnly=false, BypassHTMLValidation=true, IgnorePath = "/api2/chatHub/negotiate" });

Add code: WrapperBase.cs at line 63
var path = context.Request.Path.Value; if (_options.IgnorePath!=null && _options.IgnorePath== path) { await awm.WrapIgnoreAsync(context, bodyAsText); }

If you've added a custom option to ignore a specific path, you can just return instead of calling WrapIgnoreAsync

Is that so?

if (_options.IgnorePath!=null && _options.IgnorePath== path) { return; }

With the ExcludePath option comes with the latest version, I think this should resolved your issue. See; https://vmsdurano.com/autowrapper-4-5-0-released/