using System;
using System.Net.Http;
using Blazorise;
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 OpenIddict.Abstractions;
using Syncfusion.Blazor;
using System;
using System.Net.Http;
using TechGenius.Blazor.Client.Components.Layout;
using TechGenius.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.Mapperly;
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 TechGenius.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.Identity.Pro.Blazor;
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;
using Volo.Saas.Host.Blazor.WebAssembly;
using Volo.Chat.Blazor.WebAssembly;
using Volo.Abp.AspNetCore.Components.Web.LeptonXTheme.Components;
using Volo.Abp.AspNetCore.Components.WebAssembly.LeptonXTheme.Bundling;
namespace TechGenius.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(AbpAspNetCoreComponentsWebAssemblyLeptonXThemeBundlingModule),
typeof(AbpAspNetCoreComponentsWebAssemblyLeptonXThemeModule),
typeof(AbpAutofacWebAssemblyModule),
typeof(TechGeniusHttpApiClientModule),
typeof(ChatBlazorWebAssemblyModule)
) ]
public class TechGeniusBlazorClientModule : 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();
context.Services.AddSyncfusionBlazor();
ConfigureAuthentication(builder);
ConfigureImpersonation(context);
ConfigureHttpClient(context, environment);
ConfigureBlazorise(context);
ConfigureRouter(context);
ConfigureMenu(context);
ConfigureCookieConsent(context);
ConfigureTheme();
ConfigureBundles();
//ConfigureAutoMapper(context);
}
private void ConfigureBundles()
{
Configure<AbpBundlingOptions>(options =>
{
//var globalScripts = options.ScriptBundles.Get(BlazorWebAssemblyStandardBundles.Scripts.Global);
//globalScripts.AddContributors(typeof(MonacoBundleScriptContributor));
//options
// .ScriptBundles
// .Add("MyGlobalBundle", bundle =>
// {
// bundle.AddFiles(
// "_content/BlazorMonaco/jsInterop.js",
// "_content/BlazorMonaco/lib/monaco-editor/min/vs/loader.js",
// "_content/BlazorMonaco/lib/monaco-editor/min/vs/editor/editor.main.js"
// );
// });
//options.ScriptBundles.Configure(
////BlazorWebAssemblyStandardBundles
//// BlazorLeptonXThemeBundles
//// Or BasicThemeBundles.Scripts.Global
//// Or LeptonXLiteThemeBundles.Scripts.Global
//// 👇 Depends on the theme you are using
//BlazorWebAssemblyStandardBundles.Scripts.Global,
//bundle =>
//{
// bundle.AddContributors(typeof(MonacoBundleScriptContributor));
//});
options.ScriptBundles.Configure(
BlazorWebAssemblyStandardBundles.Scripts.Global,
bundle =>
{
bundle.AddFiles("_content/BlazorMonaco/jsInterop.js");
bundle.AddFiles("_content/BlazorMonaco/lib/monaco-editor/min/vs/loader.js");
bundle.AddFiles("_content/BlazorMonaco/lib/monaco-editor/min/vs/editor/editor.main.js");
}
);
//options.ScriptBundles.Configure(
//// Or BasicThemeBundles.Scripts.Global
//// Or LeptonXLiteThemeBundles.Scripts.Global
//// 👇 Depends on the theme you are using
//BlazorLeptonXThemeBundles.Scripts.Global,
//bundle =>
//{
// bundle.AddFiles(new BundleFile("/vue.js", true));
// // 👇 Make sure to add this line
// bundle.AddContributors(typeof(Vue3Contributor));
//});
});
}
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 TechGeniusBlazorModule.cs should be updated accordingly.
options.Layout = LeptonXBlazorLayouts.SideMenu;
});
}
private void ConfigureRouter(ServiceConfigurationContext context)
{
Configure<AbpRouterOptions>(options =>
{
options.AppAssembly = typeof(TechGeniusBlazorClientModule).Assembly;
options.AdditionalAssemblies.Add(typeof(TechGeniusBlazorClientModule).Assembly);
});
}
private void ConfigureMenu(ServiceConfigurationContext context)
{
Configure<AbpNavigationOptions>(options =>
{
options.MenuContributors.Add(new TechGeniusMenuContributor(context.Services.GetConfiguration()));
});
}
private void ConfigureBlazorise(ServiceConfigurationContext context)
{
context.Services
.AddBlazorise(options =>
{
// TODO (IMPORTANT): To use Blazorise, you need a license key. Get your license key directly from Blazorise, follow the instructions at https://abp.io/faq#how-to-get-blazorise-license-key
options.ProductToken = "xxx";
})
.AddBootstrap5Providers()
.AddFontAwesomeIcons();
}
private static void ConfigureAuthentication(WebAssemblyHostBuilder builder)
{
builder.Services.AddBlazorWebAppServices();
}
private void ConfigureImpersonation(ServiceConfigurationContext context)
{
context.Services.Configure<SaasHostBlazorOptions>(options =>
{
options.EnableTenantImpersonation = true;
});
context.Services.Configure<AbpIdentityProBlazorOptions>(options =>
{
options.EnableUserImpersonation = true;
});
}
private static void ConfigureHttpClient(ServiceConfigurationContext context, IWebAssemblyHostEnvironment environment)
{
context.Services.AddTransient(sp => new HttpClient
{
BaseAddress = new Uri(environment.BaseAddress)
});
}
//private void ConfigureAutoMapper(ServiceConfigurationContext context)
//{
// context.Services.AddAutoMapperObjectMapper();
// Configure<AbpAutoMapperOptions>(options =>
// {
// options.AddMaps<TechGeniusBlazorClientModule>();
// });
//}
}
global.js 也无法访问.移除了MonacoBundleScriptContributor,在client项目直接添加了JS
返回404
Request finished HTTP/2 GET https://localhost:44353/Global.js - 404 0 null 123.0308ms
blazor <ItemGroup> <PackageReference Include="Volo.Abp.AspNetCore.Components.Server.LeptonXTheme" Version="5.0.0" /> <PackageReference Include="Volo.Abp.AspNetCore.Mvc.UI.Theme.LeptonX" Version="5.0.0" /> <PackageReference Include="Volo.Abp.AspNetCore.Components.WebAssembly.LeptonXTheme.Bundling" Version="5.0.0" /> </ItemGroup>
blazor.client <PackageReference Include="Volo.Abp.AspNetCore.Components.WebAssembly.LeptonXTheme" Version="5.0.0" />
https://github.com/abpframework/abp/blob/dev/docs/en/Community-Articles/2024-11-25-Global-Assets/POST.md
你好
现在根据文档添加全局js文件 但是无法生成global.js
blazor 项目添加了
typeof(AbpAspNetCoreMvcUiBundlingModule)
,typeof(AbpAuditLoggingBlazorWebAssemblyBundlingModule)
blazor.client项目代码 public class MonacoBundleScriptContributor : BundleContributor { public override void ConfigureBundle(BundleConfigurationContext context) { context.Files.Add(new BundleFile("_content/BlazorMonaco/jsInterop.js", true)); context.Files.Add(new BundleFile("_content/BlazorMonaco/lib/monaco-editor/min/vs/loader.js", true)); context.Files.Add(new BundleFile("_content/BlazorMonaco/lib/monaco-editor/min/vs/editor/editor.main.js", true));
//context.Files.Add(new BundleFile("/BlazorMonaco/jsInterop.js", true));
//context.Files.Add(new BundleFile("/BlazorMonaco/monaco-editor/min/vs/loader.js", true));
//context.Files.Add(new BundleFile("/BlazorMonaco/monaco-editor/min/vs/editor/editor.main.js", true));
}
}
private void ConfigureBundles()
{
Configure<AbpBundlingOptions>(options =>
{
var globalScripts = options.ScriptBundles.Get(BlazorWebAssemblyStandardBundles.Scripts.Global);
globalScripts.AddContributors(typeof(MonacoBundleScriptContributor));
});
}
项目启动后无法访问global.js
好的 了解了.谢谢
动态代理还会在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)