Giter Club home page Giter Club logo

Comments (6)

iammukeshm avatar iammukeshm commented on August 29, 2024

@kallievz I have added a small fix related to this. Can you please pull the latest from main branch and test this if your problem is solved?

from dotnet-webapi-boilerplate.

kallievz avatar kallievz commented on August 29, 2024

Hi @iammukeshm , is this for Blazor Debug, or the unauth exception?

from dotnet-webapi-boilerplate.

iammukeshm avatar iammukeshm commented on August 29, 2024

@kallievz it's for the Blazor Debug. I dont seem to have any Auth related issue.

from dotnet-webapi-boilerplate.

kallievz avatar kallievz commented on August 29, 2024

Hi @iammukeshm , running project now launch the browser, it hit the breakpoint once, and errors out with Unauth exception. Brower launches on different port as configured in appsetting.json, and seems to change everytime the project run. Using the one that start up from Aspire does not hit breakpoint. Is there a way to add Cors with only localhost instead of specifying port?
If it was just localhost, it would work, but now the port is set dynamically everytime project run,

from dotnet-webapi-boilerplate.

iammukeshm avatar iammukeshm commented on August 29, 2024

@kallievz so the blazor app is set to run on 7100 port. If this port is already in use, it would re-assign to a random port, which i think is happening in your case. Do check if the port is in use.

Else, as a work around, you can disable CORS.

Open up namespace FSH.Framework.Infrastructure.Cors.Extensions and edit the following, just add .AllowAnyOrigin()

internal static IServiceCollection AddCorsPolicy(this IServiceCollection services, IConfiguration config)
{
    var corsOptions = config.GetSection(nameof(CorsOptions)).Get<CorsOptions>();
    if (corsOptions == null) { return services; }
    return services.AddCors(opt =>
    opt.AddPolicy(CorsPolicy, policy =>
        policy.AllowAnyHeader()
            .AllowAnyMethod()
            .AllowAnyOrigin()));
}

from dotnet-webapi-boilerplate.

kallievz avatar kallievz commented on August 29, 2024

It could be a workaround, but would prefer to use Cors policy. A bit paranoid about unauthed access. I dont want to open that door, but for a dev environment i could prob do it.

It is being used already by Aspire Blazor app.
So it seems it is spinning up the Blazor app twice, and linking debugger to the new one not configured on port 7100, almost like 2 Blazor instances running, and one being linked.

from dotnet-webapi-boilerplate.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.