C# 在请求的url Blazor中找不到System.xxxx DLL

C# 在请求的url Blazor中找不到System.xxxx DLL,c#,.net,blazor,webassembly,C#,.net,Blazor,Webassembly,我最近升级到了.NET5的项目。但是,它会自动将\u bin部分添加到url,这会导致应用程序无法工作。当我创建新的try-purposed wasm项目时,没有\u-bin部分。整个解决方案中没有任何字符串\u bin。它是从哪里来的?我怎样才能克服这个问题 当我将矩形url更改为https://localhost:44395/ServiceApp/_framework/System.Threading.ThreadPool.dll,即通过从url中删除\u bin部分来下载dll Sta

我最近升级到了.NET5的项目。但是,它会自动将
\u bin
部分添加到url,这会导致应用程序无法工作。当我创建新的try-purposed wasm项目时,没有
\u-bin
部分。整个解决方案中没有任何字符串
\u bin
。它是从哪里来的?我怎样才能克服这个问题

当我将矩形url更改为
https://localhost:44395/ServiceApp/_framework/System.Threading.ThreadPool.dll
,即通过从url中删除
\u bin
部分来下载dll

Startup.cs


namespace My.Server
{
    public class Startup
    {
#if DEBUG
        readonly string MyAllowSpecificOrigins = "_myAllowSpecificOrigins";
#endif
        public Startup(IConfiguration configuration)
        {
            Configuration = configuration;
        }

        public IConfiguration Configuration { get; }

        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            
            services.AddSignalR(configure=>
            {
                configure.EnableDetailedErrors=true;
            });
            services.AddSingleton<ServiceAppHubManager>();
            services.AddDbContext<ApplicationDBContext>(options =>
                                                        {
                                                            options.UseMySql(
                                                                             Configuration.GetConnectionString("DefaultConnection"),
                                                                             ServerVersion.FromString("8.0.21-mysql"), // <-- use ServerVersion.FromString() with a "-mysql" suffix instead
                                                                             mySqlOptions => mySqlOptions
                                                                                .CharSetBehavior(CharSetBehavior.NeverAppend));
                                                            /*
                                                            options.UseMySql(
                                                                             Configuration.GetConnectionString("DefaultConnection"),
                                                                             new MySqlServerVersion(new Version(8, 0, 22)), // <-- use new Version() parameter instead
                                                                             mySqlOptions => mySqlOptions
                                                                                .CharSetBehavior(CharSetBehavior.NeverAppend));*/


                //options.UseMySQL(Configuration.GetConnectionString("DefaultConnection"));
                //options.UseQueryTrackingBehavior(QueryTrackingBehavior.NoTracking);
                options.EnableSensitiveDataLogging(true).EnableDetailedErrors(true);
            });
            
            services.AddDataProtection().PersistKeysToDbContext<ApplicationDBContext>();

            services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme).AddCookie();
            services.ConfigureApplicationCookie(options =>
            {
                options.Cookie.HttpOnly = true;
                options.Events.OnRedirectToLogin = context =>
                {
                    context.Response.StatusCode = 401;
                    return Task.CompletedTask;
                };
            });
            
            var mapperConfig = new MapperConfiguration(mc =>
            {
                mc.AddProfile(new MappingProfile());
            });

            IMapper mapper = mapperConfig.CreateMapper();
            services.AddSingleton(mapper);
            services.AddControllers().AddJsonOptions(options =>
            {
                // Use the default property (Pascal) casing.
                options.JsonSerializerOptions.PropertyNamingPolicy = null;
            });//.AddMvcOptions(option=>option.Filters.Add<LogRequestResponseActionFilterAsync>());
            
            services.AddControllersWithViews();
            services.AddHttpContextAccessor();
            services.AddRazorPages();
            services.AddResponseCompression(opts =>
            {
                opts.MimeTypes = ResponseCompressionDefaults.MimeTypes.Concat(
                    new[] { "application/octet-stream" });
            });
#if DEBUG
            
            services.AddCors(options =>
            {
                options.AddPolicy(name: MyAllowSpecificOrigins,
                    builder =>
                    {
                        builder.WithOrigins("https://localhost:44310")
                        .AllowAnyHeader()
                        .AllowAnyMethod()
                        //.AllowAnyOrigin()
                        .AllowAnyMethod()
                        .AllowCredentials()
                        ;
                    });
            });
#endif
        }

        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            app.UseResponseCompression();

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
                // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
                app.UseHsts();
            }

            
            app.UseHttpsRedirection();
            app.UseStaticFiles();

            app.UseRouting();

#if DEBUG
            app.UseCors(MyAllowSpecificOrigins);
#endif
            app.UseAuthentication();
            app.UseAuthorization();
            
            app.UseMiddleware<RequestResponseLoggingMiddleware>();
            
            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllerRoute(
                    name: "default",
                    pattern: "{controller=Home}/{action=Index}/{id?}");
                endpoints.MapHub<ServiceAppHub>("/serviceapphub");
            });

            app.Map("/ServiceApp", serviceApp =>
            {
                serviceApp.Use((ctx, nxt) =>
                               {
                                   if (!ctx.Request.Path.Value.StartsWith("/ServiceApp"))
                                       ctx.Request.Path = "/ServiceApp" + ctx.Request.Path;
                                   return nxt();
                               });
                serviceApp.UseHttpsRedirection();
                serviceApp.UseBlazorFrameworkFiles("/ServiceApp");
                serviceApp.UseStaticFiles();
                serviceApp.UseStaticFiles("/ServiceApp");
                serviceApp.UseRouting();

                serviceApp.UseEndpoints(endpoints =>
                {
                    endpoints.MapControllers();
                    endpoints.MapFallbackToFile("/ServiceApp/{*path:nonfile}",
                        "ServiceApp/index.html");
                });
            });
        }
    }
}


名称空间My.Server
{
公营创业
{
#如果调试
只读字符串MyAllowSpecificCorigins=“\u MyAllowSpecificCorigins”;
#恩迪夫
公共启动(IConfiguration配置)
{
配置=配置;
}
公共IConfiguration配置{get;}
//此方法由运行时调用。请使用此方法将服务添加到容器中。
public void配置服务(IServiceCollection服务)
{
services.AddSignalR(配置=>
{
configure.EnableDetailedErrors=true;
});
services.AddSingleton();
services.AddDbContext(选项=>
{
options.UseMySql(
Configuration.GetConnectionString(“DefaultConnection”),
ServerVersion.FromString(“8.0.21-mysql”),//mySqlOptions
.CharSetBehavior(CharSetBehavior.NeverAppend));
/*
options.UseMySql(
Configuration.GetConnectionString(“DefaultConnection”),
新的MySqlServerVersion(新版本(8,0,22)),//mySqlOptions
.CharSetBehavior(CharSetBehavior.NeverAppend))*/
//options.UseMySQL(Configuration.GetConnectionString(“DefaultConnection”));
//options.UseQueryTrackingBehavior(QueryTrackingBehavior.NotTracking);
选项。EnableSensitiveDataLogging(真)。EnableDetailedErrors(真);
});
services.AddDataProtection().PersistKeysdbContext();
services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme).AddCookie();
services.configureApplicationOK(选项=>
{
options.Cookie.HttpOnly=true;
options.Events.OnRedirectToLogin=上下文=>
{
context.Response.StatusCode=401;
返回Task.CompletedTask;
};
});
var mapperConfig=新的MapperConfiguration(mc=>
{
mc.AddProfile(新的MappingProfile());
});
IMapper mapper=mapperConfig.CreateMapper();
服务。AddSingleton(映射器);
services.AddControllers().AddJsonOptions(选项=>
{
//使用默认属性(Pascal)大小写。
options.JsonSerializerOptions.PropertyNamingPolicy=null;
});//.addmvcopions(option=>option.Filters.Add());
services.AddControllersWithViews();
AddHttpContextAccessor();
services.AddRazorPages();
services.AddResponseCompression(选项=>
{
opts.MimeTypes=ResponseCompressionDefaults.MimeTypes.Concat(
新[]{“应用程序/八位字节流”});
});
#如果调试
services.AddCors(选项=>
{
options.AddPolicy(名称:MyAllowSpecificCorigins,
生成器=>
{
建筑商。来源(“https://localhost:44310")
.AllowAnyHeader()
.AllowAnyMethod()
//.AllowAnyOrigin()
.AllowAnyMethod()
.AllowCredentials()
;
});
});
#恩迪夫
}
//此方法由运行时调用。请使用此方法配置HTTP请求管道。
public void配置(IApplicationBuilder应用程序、IWebHostEnvironment环境)
{
app.UseResponseCompression();
if(env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
其他的
{
app.UseExceptionHandler(“/Home/Error”);
//默认的HSTS值为30天。您可能希望在生产场景中更改此值,请参阅https://aka.ms/aspnetcore-hsts.
app.UseHsts();
}
app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseRouting();
#如果调试
应用程序UseCors(MyAllowSpecificCorigins);
#恩迪夫
app.UseAuthentication();
app.UseAuthorization();
app.UseMiddleware();
app.UseEndpoints(端点=>
{
endpoints.MapControllerRoute(
名称:“默认”,
模式:“{controller=Home}/{action=Index}/{id?}”);
endpoints.MapHub(“/serviceapphub”);
});
app.Map(“/ServiceApp”,ServiceApp=>