小编Kre*_*lex的帖子

应用程序启动时 Blazor css 文件不更新

然而,我将一些自定义 CSS 从 bootstraps 网站添加到 Blazor 中的 app.css 文件中,同时在 Visual Studio 中编辑并保存该文件。当应用程序启动并加载 app.css 时,它会加载旧版本的 app.css 而无需我进行更改。有人知道为什么会发生这种情况吗?提前致谢

编辑后的 ​​CSS 文件

// ... some more css above....

.b-example-divider {
    height: 3rem;
    background-color: rgba(0, 0, 0, .1);
    border: solid rgba(0, 0, 0, .15);
    border-width: 1px 0;
    box-shadow: inset 0 0.5em 1.5em rgb(0 0 0 / 10%), inset 0 0.125em 0.5em rgb(0 0 0 / 15%);
}

#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: …
Run Code Online (Sandbox Code Playgroud)

css blazor blazor-webassembly

6
推荐指数
1
解决办法
7783
查看次数

Swagger 未提供 API 定义

我正在将 Swagger 实现到我的 Blazor WebAssembly 项目中,但 swagger 似乎无法识别我的任何 API?似乎无法弄清楚这个问题,并且想知道是否有人知道为什么会发生这种情况。提前致谢。

在服务器项目中安装了Swashbuckle.AspNetCore

我的控制器不使用传统的控制器Route(["api/controller"]),而是使用Route(["controller"])我认为不会导致此问题的控制器。

此外,所有控制器功能都已标记为 get/post/put 例如HttpGet[(...)] ...

启动.cs

public class Startup
{
    public Startup(IConfiguration configuration)
    {
        Configuration = configuration;
    }

    public IConfiguration Configuration { get; }

    public void ConfigureServices(IServiceCollection services)
    {
        services.AddDbContext<ApplicationDbContext>(options =>
            options.UseSqlServer(
                Configuration.GetConnectionString("DefaultConnection")));

        services.AddDatabaseDeveloperPageExceptionFilter();

        services.AddDefaultIdentity<ApplicationUser>(options => options.SignIn.RequireConfirmedAccount = false)
            .AddRoles<IdentityRole>()
            .AddEntityFrameworkStores<ApplicationDbContext>();

        services.AddIdentityServer()
            .AddApiAuthorization<ApplicationUser, ApplicationDbContext>(options => {
                options.IdentityResources["openid"].UserClaims.Add("role");
                options.ApiResources.Single().UserClaims.Add("role");
            });

        JwtSecurityTokenHandler.DefaultInboundClaimTypeMap.Remove("role");

        services.AddAuthentication()
            .AddIdentityServerJwt();

        services.AddControllersWithViews();

        services.AddRazorPages();

        services.Configure<IdentityOptions>(options =>
        options.ClaimsIdentity.UserIdClaimType = ClaimTypes.NameIdentifier);

       services.AddControllers().AddNewtonsoftJson(x => x.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize); …
Run Code Online (Sandbox Code Playgroud)

swagger swagger-ui blazor swashbuckle.aspnetcore blazor-webassembly

5
推荐指数
1
解决办法
1万
查看次数