好的 了解了.谢谢
动态代理还会在Blazor webapp分层项目中支持吗?
之前查看了这个.解决方案也是使用静态代理. 这个是9.3.5目前的BUG?使用动态代理多久可以恢复呢? https://abp.io/support/questions/4300/Abp-Suite-Generating-a-CRUD-page-BUG
已设置
重新创建了一个.已发送邀请
已上传
项目api 部署在https://master.aysdlrmyy.com:28445 认证 部署在https://master.aysdlrmyy.com:28443 本地blazor host启动路径是https://localhost:44333 查看了迁移记录 https://abp.io/docs/latest/release-info/migration-guides/abp-8-2-blazor-web-app
https://github.com/abpframework/abp/issues/22622
修改了RemoteServices.BaseUrl
"RemoteServices": { "Default": { "BaseUrl": "https://localhost:44333" },
现在无法wasm下找不到HTTP方法.
Unhandled exception rendering component: Could not find remote action for method: System.Threading.Tasks.Task1[Volo.Abp.Application.Dtos.PagedResultDto1[Contract.Shared.LookupDto1[System.Guid]]] GetReviewKeyLookupAsync(Contract.Shared.LookupRequestDto) on the URL: https://localhost:44333 Volo.Abp.AbpException: Could not find remote action for method: System.Threading.Tasks.Task1[Volo.Abp.Application.Dtos.PagedResultDto1[Contract.Shared.LookupDto1[System.Guid]]] GetReviewKeyLookupAsync(Contract.Shared.LookupRequestDto) on the URL: https://localhost:44333
at Volo.Abp.Http.Client.DynamicProxying.ApiDescriptionFinder.FindActionAsync(:44333/HttpClient client, String baseUrl, Type serviceType, MethodInfo method)
at Volo.Abp.Http.Client.DynamicProxying.DynamicHttpProxyInterceptor1.<GetActionApiDescriptionModel>d__25[[Contract.ClassOnes.IClassOnesAppService, Contract.Application.Contracts, Version=0.1.0.0, Culture=neutral, PublicKeyToken=null]].MoveNext((索引)) at Volo.Abp.Http.Client.DynamicProxying.DynamicHttpProxyInterceptor1.<InterceptAsync>d__24[[Contract.ClassOnes.IClassOnesAppService, Contract.Application.Contracts, Version=0.1.0.0, Culture=neutral, PublicKeyToken=null]].MoveNext((索引))
at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter1.<InterceptAsync>d__31[[Volo.Abp.Http.Client.DynamicProxying.DynamicHttpProxyInterceptor1[[Contract.ClassOnes.IClassOnesAppService, Contract.Application.Contracts, Version=0.1.0.0, Culture=neutral, PublicKeyToken=null]], Volo.Abp.Http.Client, Version=9.3.5.0, Culture=neutral, PublicKeyToken=null],[Volo.Abp.Application.Dtos.PagedResultDto1[[Contract.Shared.LookupDto1[[System.Guid, System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], Contract.Application.Contracts, Version=0.1.0.0, Culture=neutral, PublicKeyToken=null]], Volo.Abp.Ddd.Application.Contracts, Version=9.3.5.0, Culture=neutral, PublicKeyToken=null]].MoveNext((索引)) at Castle.DynamicProxy.AsyncInterceptorBase.<ProceedAsynchronous>d__141[[Volo.Abp.Application.Dtos.PagedResultDto1[[Contract.Shared.LookupDto1[[System.Guid, System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], Contract.Application.Contracts, Version=0.1.0.0, Culture=neutral, PublicKeyToken=null]], Volo.Abp.Ddd.Application.Contracts, Version=9.3.5.0, Culture=neutral, PublicKeyToken=null]].MoveNext((索引))
at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue1.<ProceedAsync>d__7[[Volo.Abp.Application.Dtos.PagedResultDto1[[Contract.Shared.LookupDto1[[System.Guid, System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], Contract.Application.Contracts, Version=0.1.0.0, Culture=neutral, PublicKeyToken=null]], Volo.Abp.Ddd.Application.Contracts, Version=9.3.5.0, Culture=neutral, PublicKeyToken=null]].MoveNext((索引)) at Volo.Abp.Validation.ValidationInterceptor.InterceptAsync(:44333/IAbpMethodInvocation invocation) at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter1.<InterceptAsync>d__31[[Volo.Abp.Validation.ValidationInterceptor, Volo.Abp.Validation, Version=9.3.5.0, Culture=neutral, PublicKeyToken=null],[Volo.Abp.Application.Dtos.PagedResultDto1[[Contract.Shared.LookupDto`1[[System.Guid, System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], Contract.Application.Contracts, Version=0.1.0.0, Culture=neutral, PublicKeyToken=null]], Volo.Abp.Ddd.Application.Contracts, Version=9.3.5.0, Culture=neutral, PublicKeyToken=null]].MoveNext((索引))
at :44333/Contract.Blazor.Pages.Contract.ClassOnes.GetReviewKeyLookupAsync(String newValue) in E:\Master9.0\modules\Contract\src\Contract.Blazor\Pages\Contract\ClassOnes.razor.cs:line 401
at :44333/Contract.Blazor.Pages.Contract.ClassOnes.OnInitializedAsync() in E:\Master9.0\modules\Contract\src\Contract.Blazor\Pages\Contract\ClassOnes.razor.cs:line 115
at Microsoft.AspNetCore.Components.ComponentBase.RunInitAndSetParametersAsync((索引))
at Microsoft.AspNetCore.Components.RenderTree.Renderer.GetErrorHandledTask(:44333/Task taskToHandle, ComponentState owningComponentState)
{ "AuthServer": { "Authority": "https://master.aysdlrmyy.com:28443" }, "RemoteServices": { "Default": { "BaseUrl": "https://master.aysdlrmyy.com:28445" }, "AbpAccountPublic": { "BaseUrl": "https://master.aysdlrmyy.com:28443" } } }
api 部署在https://master.aysdlrmyy.com:28445 端口下. 目前浏览器中报这个错误:warn: Volo.Abp.IdentityModel.IdentityModelAuthenticationService[0] Could not find IdentityClientConfiguration for AbpMvcClient. Either define a configuration for AbpMvcClient or set a default configuration.
client
using System;
using System.Net.Http;
using Blazorise.Bootstrap5;
using Blazorise.Icons.FontAwesome;
using Microsoft.AspNetCore.Components.WebAssembly.Authentication;
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
using Master9.Blazor.Client.Navigation;
using OpenIddict.Abstractions;
using Volo.Abp.AspNetCore.Components.Web;
using Volo.Abp.AspNetCore.Components.Web.Theming.Routing;
using Volo.Abp.Autofac.WebAssembly;
using Volo.Abp.AutoMapper;
using Volo.Abp.Modularity;
using Volo.Abp.UI.Navigation;
using Volo.Abp.AspNetCore.Mvc.UI.Bundling;
using Volo.Abp.AspNetCore.Components.WebAssembly.Theming.Bundling;
using Master9.Blazor.Client.Components.Layout;
using Volo.Abp.AspNetCore.Components.WebAssembly.LeptonXTheme;
using Volo.Abp.AspNetCore.Components.Web.LeptonXTheme;
using Volo.Abp.LeptonX.Shared;
using Volo.Abp.SettingManagement.Blazor.WebAssembly;
using Volo.Abp.FeatureManagement.Blazor.WebAssembly;
using Volo.Abp.Account.Pro.Admin.Blazor.WebAssembly;
using Volo.Abp.Account.Pro.Public.Blazor.WebAssembly;
using Volo.Abp.Identity.Pro.Blazor.Server.WebAssembly;
using Volo.Abp.AuditLogging.Blazor.WebAssembly;
using Volo.Abp.Gdpr.Blazor.Extensions;
using Volo.Abp.Gdpr.Blazor.WebAssembly;
using Volo.Abp.LanguageManagement.Blazor.WebAssembly;
using Volo.Abp.OpenIddict.Pro.Blazor.WebAssembly;
using Volo.Abp.TextTemplateManagement.Blazor.WebAssembly;
using Volo.Saas.Host.Blazor.WebAssembly;
using FollowUp.Blazor.WebAssembly;
using Contract.Blazor.WebAssembly;
using DevExpress.Blazor;
using DevExpress.Blazor.Localization;
using Master9.Blazor.Client.Resources;
using System.Globalization;
namespace Master9.Blazor.Client;
[DependsOn(
typeof(AbpSettingManagementBlazorWebAssemblyModule),
typeof(AbpFeatureManagementBlazorWebAssemblyModule),
typeof(AbpAccountAdminBlazorWebAssemblyModule),
typeof(AbpAccountPublicBlazorWebAssemblyModule),
typeof(AbpIdentityProBlazorWebAssemblyModule),
typeof(SaasHostBlazorWebAssemblyModule),
typeof(AbpOpenIddictProBlazorWebAssemblyModule),
typeof(AbpAuditLoggingBlazorWebAssemblyModule),
typeof(AbpGdprBlazorWebAssemblyModule),
typeof(TextTemplateManagementBlazorWebAssemblyModule),
typeof(LanguageManagementBlazorWebAssemblyModule),
typeof(AbpAspNetCoreComponentsWebAssemblyLeptonXThemeModule),
typeof(AbpAutofacWebAssemblyModule),
typeof(Master9HttpApiClientModule)
)]
[DependsOn(typeof(FollowUpBlazorWebAssemblyModule))]
[DependsOn(typeof(ContractBlazorWebAssemblyModule))]
public class Master9BlazorClientModule : AbpModule
{
public override void PreConfigureServices(ServiceConfigurationContext context)
{
PreConfigure<AbpAspNetCoreComponentsWebOptions>(options =>
{
options.IsBlazorWebApp = true;
});
}
public override void ConfigureServices(ServiceConfigurationContext context)
{
var environment = context.Services.GetSingletonInstance<IWebAssemblyHostEnvironment>();
var builder = context.Services.GetSingletonInstance<WebAssemblyHostBuilder>();
context.Services.AddDevExpressBlazor(configure => configure.BootstrapVersion = BootstrapVersion.v5);
ConfigureDevExpressL18n(builder);
ConfigureAuthentication(builder);
ConfigureHttpClient(context, environment);
ConfigureBlazorise(context);
ConfigureRouter(context);
ConfigureMenu(context);
ConfigureAutoMapper(context);
ConfigureCookieConsent(context);
ConfigureTheme();
}
private void ConfigureCookieConsent(ServiceConfigurationContext context)
{
context.Services.AddAbpCookieConsent(options =>
{
options.IsEnabled = true;
options.CookiePolicyUrl = "/CookiePolicy";
options.PrivacyPolicyUrl = "/PrivacyPolicy";
});
}
private void ConfigureTheme()
{
Configure<LeptonXThemeOptions>(options =>
{
options.DefaultStyle = LeptonXStyleNames.System;
});
Configure<LeptonXThemeBlazorOptions>(options =>
{
// When Layout is changed, the `options.Parameters["LeptonXTheme.Layout"]` in Master9BlazorModule.cs should be updated accordingly.
options.Layout = LeptonXBlazorLayouts.SideMenu;
});
}
private void ConfigureRouter(ServiceConfigurationContext context)
{
Configure<AbpRouterOptions>(options =>
{
options.AppAssembly = typeof(Master9BlazorClientModule).Assembly;
});
}
private void ConfigureMenu(ServiceConfigurationContext context)
{
Configure<AbpNavigationOptions>(options =>
{
options.MenuContributors.Add(new Master9MenuContributor(context.Services.GetConfiguration()));
});
}
private void ConfigureBlazorise(ServiceConfigurationContext context)
{
context.Services
.AddBootstrap5Providers()
.AddFontAwesomeIcons();
}
private static void ConfigureAuthentication(WebAssemblyHostBuilder builder)
{
builder.Services.AddBlazorWebAppServices();
//builder.Services.AddBlazorWebAppTieredServices();
}
private static void ConfigureHttpClient(ServiceConfigurationContext context, IWebAssemblyHostEnvironment environment)
{
context.Services.AddTransient(sp => new HttpClient()
{
BaseAddress = new Uri(environment.BaseAddress),
});
}
private void ConfigureAutoMapper(ServiceConfigurationContext context)
{
Configure<AbpAutoMapperOptions>(options =>
{
options.AddMaps<Master9BlazorClientModule>();
});
}
private static void ConfigureDevExpressL18n(WebAssemblyHostBuilder builder)
{
builder.Services.AddLocalization();
//builder.Services.AddLocalization();
builder.Services.AddSingleton(typeof(IDxLocalizationService), typeof(LocalizationService));
var culture = new CultureInfo("zh-Hans");
CultureInfo.DefaultThreadCurrentCulture = culture;
CultureInfo.DefaultThreadCurrentUICulture = culture;
}
}
private void ConfigureAuthentication(ServiceConfigurationContext context, IConfiguration configuration) {
//Configure<AbpAntiForgeryOptions>(options =>
//{
// options.TokenCookie.Expiration = TimeSpan.FromDays(365);
// options.TokenCookie.SameSite = SameSiteMode.None;
// options.TokenCookie.SecurePolicy = CookieSecurePolicy.Always;
//});
context.Services.AddAuthentication(options =>
{
options.DefaultScheme = "Cookies";
options.DefaultChallengeScheme = "oidc";
})
.AddCookie("Cookies", options =>
{
options.ExpireTimeSpan = TimeSpan.FromDays(365);
options.IntrospectAccessToken();
})
.AddAbpOpenIdConnect("oidc", options =>
{
options.Authority = configuration["AuthServer:Authority"];
options.RequireHttpsMetadata = configuration.GetValue<bool>("AuthServer:RequireHttpsMetadata");;
options.ResponseType = OpenIdConnectResponseType.CodeIdToken;
options.ClientId = configuration["AuthServer:ClientId"];
options.ClientSecret = configuration["AuthServer:ClientSecret"];
options.SaveTokens = true;
options.GetClaimsFromUserInfoEndpoint = true;
options.Scope.Add("roles");
options.Scope.Add("email");
options.Scope.Add("phone");
options.Scope.Add("Master9");
});
if (configuration.GetValue<bool>("AuthServer:IsOnK8s"))
{
context.Services.Configure<OpenIdConnectOptions>("oidc", options =>
{
options.TokenValidationParameters.ValidIssuers = new[]
{
configuration["AuthServer:MetaAddress"]!.EnsureEndsWith('/'),
configuration["AuthServer:Authority"]!.EnsureEndsWith('/')
};
options.MetadataAddress = configuration["AuthServer:MetaAddress"]!.EnsureEndsWith('/') +
".well-known/openid-configuration";
var previousOnRedirectToIdentityProvider = options.Events.OnRedirectToIdentityProvider;
options.Events.OnRedirectToIdentityProvider = async ctx =>
{
// Intercept the redirection so the browser navigates to the right URL in your host
ctx.ProtocolMessage.IssuerAddress = configuration["AuthServer:Authority"]!.EnsureEndsWith('/') + "connect/authorize";
if (previousOnRedirectToIdentityProvider != null)
{
await previousOnRedirectToIdentityProvider(ctx);
}
};
var previousOnRedirectToIdentityProviderForSignOut = options.Events.OnRedirectToIdentityProviderForSignOut;
options.Events.OnRedirectToIdentityProviderForSignOut = async ctx =>
{
// Intercept the redirection for signout so the browser navigates to the right URL in your host
ctx.ProtocolMessage.IssuerAddress = configuration["AuthServer:Authority"]!.EnsureEndsWith('/') + "connect/endsession";
if (previousOnRedirectToIdentityProviderForSignOut != null)
{
await previousOnRedirectToIdentityProviderForSignOut(ctx);
}
};
});
}
context.Services.Configure<AbpClaimsPrincipalFactoryOptions>(options =>
{
options.IsDynamicClaimsEnabled = true;
});
}
private void ConfigureImpersonation(ServiceConfigurationContext context, IConfiguration configuration)
{
context.Services.Configure<SaasHostBlazorOptions>(options =>
{
options.EnableTenantImpersonation = true;
});
context.Services.Configure<AbpIdentityProBlazorOptions>(options =>
{
options.EnableUserImpersonation = true;
});
}
private void ConfigureVirtualFileSystem(IWebHostEnvironment hostingEnvironment)
{
if (hostingEnvironment.IsDevelopment())
{
Configure<AbpVirtualFileSystemOptions>(options =>
{
options.FileSets.ReplaceEmbeddedByPhysical<Master9DomainSharedModule>(Path.Combine(hostingEnvironment.ContentRootPath, $"..{Path.DirectorySeparatorChar}Master9.Domain.Shared"));
options.FileSets.ReplaceEmbeddedByPhysical<Master9ApplicationContractsModule>(Path.Combine(hostingEnvironment.ContentRootPath, $"..{Path.DirectorySeparatorChar}Master9.Application.Contracts"));
options.FileSets.ReplaceEmbeddedByPhysical<Master9BlazorModule>(hostingEnvironment.ContentRootPath);
});
}
}
private void ConfigureSwaggerServices(IServiceCollection services)
{
services.AddAbpSwaggerGen(
options =>
{
options.SwaggerDoc("v1", new OpenApiInfo { Title = "Master9 API", Version = "v1" });
options.DocInclusionPredicate((docName, description) => true);
options.CustomSchemaIds(type => type.FullName);
}
);
}
private void ConfigureCache(IConfiguration configuration)
{
Configure<AbpDistributedCacheOptions>(options =>
{
options.KeyPrefix = "Master9:";
});
}
private void ConfigureDataProtection(
ServiceConfigurationContext context,
IConfiguration configuration,
IWebHostEnvironment hostingEnvironment)
{
var dataProtectionBuilder = context.Services.AddDataProtection().SetApplicationName("Master9");
if (!hostingEnvironment.IsDevelopment())
{
var redis = ConnectionMultiplexer.Connect(configuration["Redis:Configuration"]!);
dataProtectionBuilder.PersistKeysToStackExchangeRedis(redis, "Master9-Protection-Keys");
}
}
private void ConfigureDistributedLocking(
ServiceConfigurationContext context,
IConfiguration configuration)
{
context.Services.AddSingleton<IDistributedLockProvider>(sp =>
{
var connection = ConnectionMultiplexer.Connect(configuration["Redis:Configuration"]!);
return new RedisDistributedSynchronizationProvider(connection.GetDatabase());
});
}
private void ConfigureBlazorise(ServiceConfigurationContext context)
{
context.Services
.AddBootstrap5Providers()
.AddFontAwesomeIcons();
}
private void ConfigureMenu(IConfiguration configuration)
{
Configure<AbpNavigationOptions>(options =>
{
options.MenuContributors.Add(new Master9MenuContributor(configuration));
});
}
private void ConfigureRouter()
{
Configure<AbpRouterOptions>(options =>
{
options.AppAssembly = typeof(Master9BlazorModule).Assembly;
options.AdditionalAssemblies.Add(typeof(Master9BlazorClientModule).Assembly);
});
}
private void ConfigureAutoMapper()
{
Configure<AbpAutoMapperOptions>(options =>
{
options.AddMaps<Master9BlazorModule>();
});
}
public override void OnApplicationInitialization(ApplicationInitializationContext context)
{
var env = context.GetEnvironment();
var app = context.GetApplicationBuilder();
app.Use(async (ctx, next) =>
{
/* Converting to https to be able to include https URLs in `/.well-known/openid-configuration` endpoint.
* This should only be done if the request is coming outside of the cluster. */
if (ctx.Request.Headers.ContainsKey("from-ingress"))
{
ctx.Request.Scheme = "https";
}
await next();
});
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
app.UseAbpRequestLocalization();
if (!env.IsDevelopment())
{
app.UseErrorPage();
app.UseHsts();
}
app.UseCorrelationId();
app.UseRouting();
var configuration = context.GetConfiguration();
if (Convert.ToBoolean(configuration["AuthServer:IsOnK8s"]))
{
app.Use(async (context, next) =>
{
if (context.Request.Path.Value != null &&
context.Request.Path.Value.StartsWith("/appsettings", StringComparison.OrdinalIgnoreCase) &&
context.Request.Path.Value.EndsWith(".json", StringComparison.OrdinalIgnoreCase))
{
// Set endpoint to null so the static files middleware will handle the request.
context.SetEndpoint(null);
}
await next(context);
});
app.UseStaticFilesForPatterns("appsettings*.json");
}
app.MapAbpStaticAssets();
app.UseAbpSecurityHeaders();
app.UseAuthentication();
if (MultiTenancyConsts.IsEnabled)
{
app.UseMultiTenancy();
}
app.UseDynamicClaims();
app.UseAntiforgery();
app.UseAuthorization();
app.UseSwagger();
app.UseAbpSwaggerUI(options =>
{
options.SwaggerEndpoint("/swagger/v1/swagger.json", "Master9 API");
});
app.UseAbpSerilogEnrichers();
app.UseConfiguredEndpoints(builder =>
{
builder.MapRazorComponents<App>()
.AddInteractiveServerRenderMode()
.AddInteractiveWebAssemblyRenderMode()
.AddAdditionalAssemblies(builder.ServiceProvider.GetRequiredService<IOptions<AbpRouterOptions>>().Value.AdditionalAssemblies.ToArray());
});
}