Activities of "alin.andersen"

Hey,

we did update our project to .NET 6 and migrated to OpenIddict.

Our client application authenticates with the scope offline_access. We need to refresh our tokens with the refresh token. But without the offline_access token the refresh token is null.

The error message we get from AuthServer is the following:

error:invalid_request
error_description:The client application is not allowed to use the 'offline_access' scope.
error_uri:https://documentation.openiddict.com/errors/ID2065

How can we enable this functionality? I did not find any documentation for this yet.

Thanks!

  • ABP Framework version: v6.0.0
  • UI type: Blazor
  • DB provider: EF Core
  • Tiered (MVC)

Hey!

On our production environment (ubuntu) we have our published application (Release) deployed.

We get this error when opening the identity clients list in the web browser:

2022-10-06 09:58:40.194 +00:00 [INF] Executed endpoint 'Volo.Abp.IdentityServer.ApiResourcesController.GetAllListAsync (Volo.Abp.IdentityServer.HttpApi)'
2022-10-06 09:58:40.194 +00:00 [INF] Request finished HTTP/1.1 GET http://api2.test.lexica.ch/api/identity-server/api-resources/all?api-version=1.0 - - - 200 - application/json;+charset=utf-8 75.2246ms
2022-10-06 09:58:40.299 +00:00 [INF] Request starting HTTP/1.1 GET http://api2.test.lexica.ch/api/identity-server/clients?Sorting=&SkipCount=0&MaxResultCount=10&api-version=1.0 - -
2022-10-06 09:58:40.301 +00:00 [INF] Executing endpoint 'Volo.Abp.IdentityServer.ClientsController.GetListAsync (Volo.Abp.IdentityServer.HttpApi)'
2022-10-06 09:58:40.301 +00:00 [INF] Route matched with {controller = "Clients", area = "identityServer", action = "GetList", page = ""}. Executing controller action with signature System.Threading.Tasks.Task`1[Volo.Abp.Application.Dtos.PagedResultDto`1[Volo.Abp.IdentityServer.Client.Dtos.ClientWithDetailsDto]] GetListAsync(Volo.Abp.IdentityServer.Client.Dtos.GetClientListInput) on controller Volo.Abp.IdentityServer.ClientsController (Volo.Abp.IdentityServer.HttpApi).
2022-10-06 09:58:40.305 +00:00 [ERR] ---------- RemoteServiceErrorInfo ----------
{
  "code": null,
  "message": "An internal error occurred during your request!",
  "details": null,
  "data": {},
  "validationErrors": null
}

2022-10-06 09:58:40.305 +00:00 [ERR] Could not load file or assembly 'System.Collections.Specialized, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.

System.IO.FileNotFoundException: Could not load file or assembly 'System.Collections.Specialized, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.

File name: 'System.Collections.Specialized, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
   at System.ComponentModel.TypeDescriptor.PipelineFilter(Int32 pipelineType, ICollection members, Object instance, IDictionary cache)
   at System.ComponentModel.TypeDescriptor.GetPropertiesImpl(Object component, Attribute[] attributes, Boolean noCustomTypeDesc, Boolean noAttributes)
   at Volo.Abp.Validation.DataAnnotationObjectValidationContributor.AddErrors(List`1 errors, Object validatingObject)
   at Volo.Abp.Validation.DataAnnotationObjectValidationContributor.ValidateObjectRecursively(List`1 errors, Object validatingObject, Int32 currentDepth)
   at Volo.Abp.Validation.DataAnnotationObjectValidationContributor.AddErrorsAsync(ObjectValidationContext context)
   at Volo.Abp.Validation.ObjectValidator.GetErrorsAsync(Object validatingObject, String name, Boolean allowNull)
   at Volo.Abp.Validation.MethodInvocationValidator.AddMethodParameterValidationErrorsAsync(IAbpValidationResult context, ParameterInfo parameterInfo, Object parameterValue)
   at Volo.Abp.Validation.MethodInvocationValidator.AddMethodParameterValidationErrorsAsync(MethodInvocationValidationContext context)
   at Volo.Abp.Validation.MethodInvocationValidator.ValidateAsync(MethodInvocationValidationContext context)
   at Volo.Abp.Validation.ValidationInterceptor.ValidateAsync(IAbpMethodInvocation invocation)
   at Volo.Abp.Validation.ValidationInterceptor.InterceptAsync(IAbpMethodInvocation invocation)
   at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter`1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func`3 proceed)
   at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo)
   at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue`1.ProceedAsync()
   at Volo.Abp.Uow.UnitOfWorkInterceptor.InterceptAsync(IAbpMethodInvocation invocation)
   at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter`1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func`3 proceed)
   at lambda_method6744(Closure , Object )
   at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()
--- End of stack trace from previous location ---
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextExceptionFilterAsync>g__Awaited|26_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
2022-10-06 09:58:40.308 +00:00 [INF] Executing ObjectResult, writing value of type 'Volo.Abp.Http.RemoteServiceErrorResponse'.
2022-10-06 09:58:40.308 +00:00 [INF] Executed action Volo.Abp.IdentityServer.ClientsController.GetListAsync (Volo.Abp.IdentityServer.HttpApi) in 6.1533ms
2022-10-06 09:58:40.308 +00:00 [INF] Executed endpoint 'Volo.Abp.IdentityServer.ClientsController.GetListAsync (Volo.Abp.IdentityServer.HttpApi)'

It seems we are missing this assembly 'System.Collections.Specialized'. I tried to publish the application again and in the output folder there is no 'System.Collections.Specialized' dll?

Any ideas?

  • ABP Framework version: v5.3.3
  • UI type: Blazor
  • DB provider: EF Core
  • Tiered

Best Regards

Hey,

so we need to upload a file from our Blazor Server App to the Backend.

Problem is we can't use the IFileForm in our ApplicationService because it depends on Microsoft.AspNetCore.Http and we do not want to include this dependency on all our clients (we have other mobile clients beside the Blazor Service client).

So the only way we can upload a file properly is to call the controller directly from our Blazor Server App with the file.

For that to work we need the URL of the Remote Service and the Bearer Access Token.

How can we inject these two required information into the Blazor Server page in order to create our own HttpClient and make the call with the file attached?

Should we retrieve the URL for the remote service by using IConfiguration? Is this the best way to do it?

Thanks!

  • UI type: Blazor
  • DB provider: EF Core
  • Tiered (MVC)

Update:

I also tried to inject IHttpClientFactory hoping the Bearer Access Token would be set. But all headers are empty.

Hey,

we need to perform sign-in in code and then generate an access token (JWT token) for that user, so we can send the token to our mobile app.

Currently we have an AuthenticationAppService which has a login method like this:

    public class AuthenticationService : ApplicationService, IAuthenticationAppService
    {
        private readonly IdentityUserManager _userManager;
        private readonly SignInManager<Volo.Abp.Identity.IdentityUser> _signInManager;
        
        public AuthenticationService(
            IdentityUserManager userManager,
            SignInManager<Volo.Abp.Identity.IdentityUser> signInManager)
        {
            _userManager = userManager;
            _signInManager = signInManager;
        }

        public async Task<LoginResult> LoginAsync(LoginInput input)
        {
            var user = await _userManager.FindByNameAsync(input.Username);

            if (user == null)
            {
                return new LoginResult()
                {
                    Success = false,
                };
            }

            var result = await _signInManager.CheckPasswordSignInAsync(user, input.Password, false);

            if (!result.Succeeded)
            {
                return new LoginResult()
                {
                    Success = false,
                };
            }

            // Generate access token.
            var accessToken = ???;

            return new LoginResult()
            {
                Success = true,
                AccessToken = accessToken,
            };
        }
    }

The sign-in works, but how can we retrieve or generate an access token. We have a tiered solution, so the identity server is in another project.

  • ABP Framework version: v5.2.1
  • UI type: Blazor
  • DB provider: EF Core
  • Tiered (MVC): yes

Hey,

we have problems when running a module inside Xamarin-Forms on iOS.

We have the following code:

var application = AbpApplicationFactory.Create<Module>(options =>  // this line throws the exception
{
    options.UseAutofac();
});

application.Initialize();

We receive the following exception:

System.PlatformNotSupportedException: Operation is not supported on this platform.
  at System.IO.FileSystemWatcher.StartRaisingEventsIfNotDisposed () [0x00019] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/external/corefx/src/System.IO.FileSystem.Watcher/src/System/IO/FileSystemWatcher.cs:664
  at System.IO.FileSystemWatcher.set_EnableRaisingEvents (System.Boolean value) [0x0001d] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/external/corefx/src/System.IO.FileSystem.Watcher/src/System/IO/FileSystemWatcher.cs:163
  at Microsoft.Extensions.FileProviders.Physical.PhysicalFilesWatcher.TryEnableFileSystemWatcher () [0x00040] in <bc6401a219974725bf7a82de6ab30543>:0
  at Microsoft.Extensions.FileProviders.Physical.PhysicalFilesWatcher.CreateFileChangeToken (System.String filter) [0x00034] in <bc6401a219974725bf7a82de6ab30543>:0
  at Microsoft.Extensions.FileProviders.PhysicalFileProvider.Watch (System.String filter) [0x00024] in <bc6401a219974725bf7a82de6ab30543>:0
  at Microsoft.Extensions.Configuration.FileConfigurationProvider.<.ctor>b__1_0 () [0x00016] in <3cfa5edff95b45d581cfb833a66bda1f>:0
  at Microsoft.Extensions.Primitives.ChangeToken+ChangeTokenRegistration`1[TState]..ctor (System.Func`1[TResult] changeTokenProducer, System.Action`1[T] changeTokenConsumer, System.Action state) [0x0001b] in &lt;a17448b39538493dabfebe0c018d8c10&gt;:0
  at Microsoft.Extensions.Primitives.ChangeToken.OnChange (System.Func`1[TResult] changeTokenProducer, System.Action changeTokenConsumer) [0x0001c] in <a17448b39538493dabfebe0c018d8c10>:0
  at Microsoft.Extensions.Configuration.FileConfigurationProvider..ctor (Microsoft.Extensions.Configuration.FileConfigurationSource source) [0x00036] in <3cfa5edff95b45d581cfb833a66bda1f>:0
  at Microsoft.Extensions.Configuration.Json.JsonConfigurationProvider..ctor (Microsoft.Extensions.Configuration.Json.JsonConfigurationSource source) [0x00000] in <13320dc1bda7441691d3d3ee4b6465b7>:0
  at Microsoft.Extensions.Configuration.Json.JsonConfigurationSource.Build (Microsoft.Extensions.Configuration.IConfigurationBuilder builder) [0x00007] in <13320dc1bda7441691d3d3ee4b6465b7>:0
  at Microsoft.Extensions.Configuration.ConfigurationBuilder.Build () [0x0001b] in <3b2c752b86514c138e527d40dea12e05>:0
  at Microsoft.Extensions.Configuration.ConfigurationHelper.BuildConfiguration (Microsoft.Extensions.Configuration.AbpConfigurationBuilderOptions options, System.Action`1[T] builderAction) [0x000ee] in D:\ci\Jenkins\workspace\abp-commercial-release\abp\framework\src\Volo.Abp.Core\Microsoft\Extensions\Configuration\ConfigurationHelper.cs:49
  at Volo.Abp.Internal.InternalServiceCollectionExtensions.AddCoreAbpServices (Microsoft.Extensions.DependencyInjection.IServiceCollection services, Volo.Abp.IAbpApplication abpApplication, Volo.Abp.AbpApplicationCreationOptions applicationCreationOptions) [0x0001c] in D:\ci\Jenkins\workspace\abp-commercial-release\abp\framework\src\Volo.Abp.Core\Volo\Abp\Internal\InternalServiceCollectionExtensions.cs:30
  at Volo.Abp.AbpApplicationBase..ctor (System.Type startupModuleType, Microsoft.Extensions.DependencyInjection.IServiceCollection services, System.Action`1[T] optionsAction) [0x0005a] in D:\ci\Jenkins\workspace\abp-commercial-release\abp\framework\src\Volo.Abp.Core\Volo\Abp\AbpApplicationBase.cs:49
  at Volo.Abp.AbpApplicationWithInternalServiceProvider..ctor (System.Type startupModuleType, Microsoft.Extensions.DependencyInjection.IServiceCollection services, System.Action`1[T] optionsAction) [0x00000] in D:\ci\Jenkins\workspace\abp-commercial-release\abp\framework\src\Volo.Abp.Core\Volo\Abp\AbpApplicationWithInternalServiceProvider.cs:27
  at Volo.Abp.AbpApplicationWithInternalServiceProvider..ctor (System.Type startupModuleType, System.Action`1[T] optionsAction) [0x00000] in D:\ci\Jenkins\workspace\abp-commercial-release\abp\framework\src\Volo.Abp.Core\Volo\Abp\AbpApplicationWithInternalServiceProvider.cs:15
  at Volo.Abp.AbpApplicationFactory.Create (System.Type startupModuleType, System.Action`1[T] optionsAction) [0x00000] in D:\ci\Jenkins\workspace\abp-commercial-release\abp\framework\src\Volo.Abp.Core\Volo\Abp\AbpApplicationFactory.cs:76
  at Volo.Abp.AbpApplicationFactory.Create[TStartupModule] (System.Action`1[T] optionsAction) [0x00000] in <73e55470c3b14481b288376a3bdad510>:0
  at App.ApplicationCreator.Create () [0x00001] in /Users/admin/Git/App/App/AbpCommercial/ApplicationCreator.cs:9
...
/Users/admin/Git/App/App/Main.cs:9

We know that System.Reflection.Emit is not supported on iOS. How can we make this work? We need the Dynamic Proxy Feature of ABP to call app services remotely.

Thanks!

Hey,

we are trying to add the Account module as source code to our project, but we get this error:

System.Exception: Build failed!
   at Volo.Abp.Cli.Build.DefaultDotNetProjectBuilder.BuildInternal(DotNetProjectInfo project, String arguments, ConcurrentBag`1 builtProjects) in D:\ci\Jenkins\workspace\abp-commercial-release\abp\framework\src\Volo.Abp.Cli.Core\Volo\Abp\Cli\Build\DefaultDotNetProjectBuilder.cs:line 92
   at Volo.Abp.Cli.Build.DefaultDotNetProjectBuilder.BuildProjects(List`1 projects, String arguments) in D:\ci\Jenkins\workspace\abp-commercial-release\abp\framework\src\Volo.Abp.Cli.Core\Volo\Abp\Cli\Build\DefaultDotNetProjectBuilder.cs:line 41
[14:01:31 ERR] Error occured while adding the module Volo.Account.Prowith source-code to the solution "0e3bb534-5f90-44ca-9b73-24b9c976a316".. System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types.
Could not load file or assembly 'Volo.Abp.Core, Version=5.1.4.0, Culture=neutral, PublicKeyToken=null'. Could not find or load a specific file. (0x80131621)
Could not load file or assembly 'Volo.Abp.UI, Version=5.1.4.0, Culture=neutral, PublicKeyToken=null'. Could not find or load a specific file. (0x80131621)
Could not load file or assembly 'Volo.Abp.Core, Version=5.1.4.0, Culture=neutral, PublicKeyToken=null'. Could not find or load a specific file. (0x80131621)
Could not load file or assembly 'Volo.Abp.UI.Navigation, Version=5.1.4.0, Culture=neutral, PublicKeyToken=null'. Could not find or load a specific file. (0x80131621)
Could not load file or assembly 'Volo.Abp.Core, Version=5.1.4.0, Culture=neutral, PublicKeyToken=null'. Could not find or load a specific file. (0x80131621)
   at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
   at System.Reflection.Assembly.GetTypes()
   at Volo.Abp.Cli.Bundling.BundlingService.GetStartupModule(String assemblyPath) in D:\ci\Jenkins\workspace\abp-commercial-release\abp\framework\src\Volo.Abp.Cli.Core\Volo\Abp\Cli\Bundling\BundlingService.cs:line 277
   at Volo.Abp.Cli.Bundling.BundlingService.BundleAsync(String directory, Boolean forceBuild) in D:\ci\Jenkins\workspace\abp-commercial-release\abp\framework\src\Volo.Abp.Cli.Core\Volo\Abp\Cli\Bundling\BundlingService.cs:line 61
   at Volo.Abp.Cli.Commands.BundleCommand.ExecuteAsync(CommandLineArgs commandLineArgs) in D:\ci\Jenkins\workspace\abp-commercial-release\abp\framework\src\Volo.Abp.Cli.Core\Volo\Abp\Cli\Commands\BundleCommand.cs:line 45
   at Volo.Abp.Cli.ProjectModification.SolutionModuleAdder.RunBundleForBlazorAsync(String[] projectFiles, ModuleWithMastersInfo module) in D:\ci\Jenkins\workspace\abp-commercial-release\abp\framework\src\Volo.Abp.Cli.Core\Volo\Abp\Cli\ProjectModification\SolutionModuleAdder.cs:line 203
   at Volo.Abp.Cli.ProjectModification.SolutionModuleAdder.AddAsync(String solutionFile, String moduleName, String version, Boolean skipDbMigrations, Boolean withSourceCode, Boolean addSourceCodeToSolutionFile, Boolean newTemplate, Boolean newProTemplate) in D:\ci\Jenkins\workspace\abp-commercial-release\abp\framework\src\Volo.Abp.Cli.Core\Volo\Abp\Cli\ProjectModification\SolutionModuleAdder.cs:line 134
   at Volo.Abp.Cli.Commands.AddModuleCommand.ExecuteAsync(CommandLineArgs commandLineArgs) in D:\ci\Jenkins\workspace\abp-commercial-release\abp\framework\src\Volo.Abp.Cli.Core\Volo\Abp\Cli\Commands\AddModuleCommand.cs:line 68
   at Volo.Abp.Suite.Controllers.AbpSuiteController.AddModuleAsync(AddModuleInput input)
System.IO.FileLoadException: Could not load file or assembly 'Volo.Abp.Core, Version=5.1.4.0, Culture=neutral, PublicKeyToken=null'. Could not find or load a specific file. (0x80131621)
File name: 'Volo.Abp.Core, Version=5.1.4.0, Culture=neutral, PublicKeyToken=null'
 ---> System.IO.FileLoadException: Could not load file or assembly 'Volo.Abp.Core, Version=5.1.4.0, Culture=neutral, PublicKeyToken=null'.
   at System.Runtime.Loader.AssemblyLoadContext.LoadFromPath(IntPtr ptrNativeAssemblyLoadContext, String ilPath, String niPath, ObjectHandleOnStack retAssembly)
   at System.Runtime.Loader.AssemblyLoadContext.LoadFromAssemblyPath(String assemblyPath)
   at System.Reflection.Assembly.LoadFrom(String assemblyFile)
   at System.Reflection.Assembly.LoadFromResolveHandler(Object sender, ResolveEventArgs args)
   at System.Runtime.Loader.AssemblyLoadContext.InvokeResolveEvent(ResolveEventHandler eventHandler, RuntimeAssembly assembly, String name)
   at System.Runtime.Loader.AssemblyLoadContext.OnAssemblyResolve(RuntimeAssembly assembly, String assemblyFullName)
System.IO.FileLoadException: Could not load file or assembly 'Volo.Abp.UI, Version=5.1.4.0, Culture=neutral, PublicKeyToken=null'. Could not find or load a specific file. (0x80131621)
File name: 'Volo.Abp.UI, Version=5.1.4.0, Culture=neutral, PublicKeyToken=null'
 ---> System.IO.FileLoadException: Could not load file or assembly 'Volo.Abp.UI, Version=5.1.4.0, Culture=neutral, PublicKeyToken=null'.
   at System.Runtime.Loader.AssemblyLoadContext.LoadFromPath(IntPtr ptrNativeAssemblyLoadContext, String ilPath, String niPath, ObjectHandleOnStack retAssembly)
   at System.Runtime.Loader.AssemblyLoadContext.LoadFromAssemblyPath(String assemblyPath)
   at System.Reflection.Assembly.LoadFrom(String assemblyFile)
   at System.Reflection.Assembly.LoadFromResolveHandler(Object sender, ResolveEventArgs args)
   at System.Runtime.Loader.AssemblyLoadContext.InvokeResolveEvent(ResolveEventHandler eventHandler, RuntimeAssembly assembly, String name)
   at System.Runtime.Loader.AssemblyLoadContext.OnAssemblyResolve(RuntimeAssembly assembly, String assemblyFullName)
System.IO.FileLoadException: Could not load file or assembly 'Volo.Abp.Core, Version=5.1.4.0, Culture=neutral, PublicKeyToken=null'. Could not find or load a specific file. (0x80131621)
File name: 'Volo.Abp.Core, Version=5.1.4.0, Culture=neutral, PublicKeyToken=null'
 ---> System.IO.FileLoadException: Could not load file or assembly 'Volo.Abp.Core, Version=5.1.4.0, Culture=neutral, PublicKeyToken=null'.
   at System.Runtime.Loader.AssemblyLoadContext.LoadFromPath(IntPtr ptrNativeAssemblyLoadContext, String ilPath, String niPath, ObjectHandleOnStack retAssembly)
   at System.Runtime.Loader.AssemblyLoadContext.LoadFromAssemblyPath(String assemblyPath)
   at System.Reflection.Assembly.LoadFrom(String assemblyFile)
   at System.Reflection.Assembly.LoadFromResolveHandler(Object sender, ResolveEventArgs args)
   at System.Runtime.Loader.AssemblyLoadContext.InvokeResolveEvent(ResolveEventHandler eventHandler, RuntimeAssembly assembly, String name)
   at System.Runtime.Loader.AssemblyLoadContext.OnAssemblyResolve(RuntimeAssembly assembly, String assemblyFullName)
System.IO.FileLoadException: Could not load file or assembly 'Volo.Abp.UI.Navigation, Version=5.1.4.0, Culture=neutral, PublicKeyToken=null'. Could not find or load a specific file. (0x80131621)
File name: 'Volo.Abp.UI.Navigation, Version=5.1.4.0, Culture=neutral, PublicKeyToken=null'
 ---> System.IO.FileLoadException: Could not load file or assembly 'Volo.Abp.UI.Navigation, Version=5.1.4.0, Culture=neutral, PublicKeyToken=null'.
   at System.Runtime.Loader.AssemblyLoadContext.LoadFromPath(IntPtr ptrNativeAssemblyLoadContext, String ilPath, String niPath, ObjectHandleOnStack retAssembly)
   at System.Runtime.Loader.AssemblyLoadContext.LoadFromAssemblyPath(String assemblyPath)
   at System.Reflection.Assembly.LoadFrom(String assemblyFile)
   at System.Reflection.Assembly.LoadFromResolveHandler(Object sender, ResolveEventArgs args)
   at System.Runtime.Loader.AssemblyLoadContext.InvokeResolveEvent(ResolveEventHandler eventHandler, RuntimeAssembly assembly, String name)
   at System.Runtime.Loader.AssemblyLoadContext.OnAssemblyResolve(RuntimeAssembly assembly, String assemblyFullName)
System.IO.FileLoadException: Could not load file or assembly 'Volo.Abp.Core, Version=5.1.4.0, Culture=neutral, PublicKeyToken=null'. Could not find or load a specific file. (0x80131621)
File name: 'Volo.Abp.Core, Version=5.1.4.0, Culture=neutral, PublicKeyToken=null'
 ---> System.IO.FileLoadException: Could not load file or assembly 'Volo.Abp.Core, Version=5.1.4.0, Culture=neutral, PublicKeyToken=null'.
   at System.Runtime.Loader.AssemblyLoadContext.LoadFromPath(IntPtr ptrNativeAssemblyLoadContext, String ilPath, String niPath, ObjectHandleOnStack retAssembly)
   at System.Runtime.Loader.AssemblyLoadContext.LoadFromAssemblyPath(String assemblyPath)
   at System.Reflection.Assembly.LoadFrom(String assemblyFile)
   at System.Reflection.Assembly.LoadFromResolveHandler(Object sender, ResolveEventArgs args)
   at System.Runtime.Loader.AssemblyLoadContext.InvokeResolveEvent(ResolveEventHandler eventHandler, RuntimeAssembly assembly, String name)
   at System.Runtime.Loader.AssemblyLoadContext.OnAssemblyResolve(RuntimeAssembly assembly, String assemblyFullName)

The reason is this:

C:\Program Files\dotnet\sdk\6.0.200\Sdks\Microsoft.NET.Sdk.Razor\targets\Microsoft.NET.Sdk.Razor.StaticWebAssets.targets(363,5): warning MSB3026: Could not copy "obj\Debug\net6.0\Acme.Blazor.dll" to "D:\NET\Acme\src\Acme.Blazor\bin\Debug\net6.0\wwwroot\_framework/Acme.Blazor.dll". Beginning retry 1 in 1000ms. The process cannot access the file 'D:\NET\Acme\src\Acme.Blazor\bin\Debug\net6.0\wwwroot\_framework\Acme.Blazor.dll' because it is being used by another process.  [D:\NET\Acme\src\Acme.Blazor\Acme.Blazor.csproj]
C:\Program Files\dotnet\sdk\6.0.200\Sdks\Microsoft.NET.Sdk.Razor\targets\Microsoft.NET.Sdk.Razor.StaticWebAssets.targets(363,5): warning MSB3026: Could not copy "obj\Debug\net6.0\Acme.Blazor.dll" to "D:\NET\Acme\src\Acme.Blazor\bin\Debug\net6.0\wwwroot\_framework/Acme.Blazor.dll". Beginning retry 2 in 1000ms. The process cannot access the file 'D:\NET\Acme\src\Acme.Blazor\bin\Debug\net6.0\wwwroot\_framework\Acme.Blazor.dll' because it is being used by another process.  [D:\NET\Acme\src\Acme.Blazor\Acme.Blazor.csproj]
C:\Program Files\dotnet\sdk\6.0.200\Sdks\Microsoft.NET.Sdk.Razor\targets\Microsoft.NET.Sdk.Razor.StaticWebAssets.targets(363,5): warning MSB3026: Could not copy "obj\Debug\net6.0\Acme.Blazor.dll" to "D:\NET\Acme\src\Acme.Blazor\bin\Debug\net6.0\wwwroot\_framework/Acme.Blazor.dll". Beginning retry 3 in 1000ms. The process cannot access the file 'D:\NET\Acme\src\Acme.Blazor\bin\Debug\net6.0\wwwroot\_framework\Acme.Blazor.dll' because it is being used by another process.  [D:\NET\Acme\src\Acme.Blazor\Acme.Blazor.csproj]
C:\Program Files\dotnet\sdk\6.0.200\Sdks\Microsoft.NET.Sdk.Razor\targets\Microsoft.NET.Sdk.Razor.StaticWebAssets.targets(363,5): warning MSB3026: Could not copy "obj\Debug\net6.0\Acme.Blazor.dll" to "D:\NET\Acme\src\Acme.Blazor\bin\Debug\net6.0\wwwroot\_framework/Acme.Blazor.dll". Beginning retry 4 in 1000ms. The process cannot access the file 'D:\NET\Acme\src\Acme.Blazor\bin\Debug\net6.0\wwwroot\_framework\Acme.Blazor.dll' because it is being used by another process.  [D:\NET\Acme\src\Acme.Blazor\Acme.Blazor.csproj]
C:\Program Files\dotnet\sdk\6.0.200\Sdks\Microsoft.NET.Sdk.Razor\targets\Microsoft.NET.Sdk.Razor.StaticWebAssets.targets(363,5): warning MSB3026: Could not copy "obj\Debug\net6.0\Acme.Blazor.dll" to "D:\NET\Acme\src\Acme.Blazor\bin\Debug\net6.0\wwwroot\_framework/Acme.Blazor.dll". Beginning retry 5 in 1000ms. The process cannot access the file 'D:\NET\Acme\src\Acme.Blazor\bin\Debug\net6.0\wwwroot\_framework\Acme.Blazor.dll' because it is being used by another process.  [D:\NET\Acme\src\Acme.Blazor\Acme.Blazor.csproj]
C:\Program Files\dotnet\sdk\6.0.200\Sdks\Microsoft.NET.Sdk.Razor\targets\Microsoft.NET.Sdk.Razor.StaticWebAssets.targets(363,5): warning MSB3026: Could not copy "obj\Debug\net6.0\Acme.Blazor.dll" to "D:\NET\Acme\src\Acme.Blazor\bin\Debug\net6.0\wwwroot\_framework/Acme.Blazor.dll". Beginning retry 6 in 1000ms. The process cannot access the file 'D:\NET\Acme\src\Acme.Blazor\bin\Debug\net6.0\wwwroot\_framework\Acme.Blazor.dll' because it is being used by another process.  [D:\NET\Acme\src\Acme.Blazor\Acme.Blazor.csproj]
C:\Program Files\dotnet\sdk\6.0.200\Sdks\Microsoft.NET.Sdk.Razor\targets\Microsoft.NET.Sdk.Razor.StaticWebAssets.targets(363,5): warning MSB3026: Could not copy "obj\Debug\net6.0\Acme.Blazor.dll" to "D:\NET\Acme\src\Acme.Blazor\bin\Debug\net6.0\wwwroot\_framework/Acme.Blazor.dll". Beginning retry 7 in 1000ms. The process cannot access the file 'D:\NET\Acme\src\Acme.Blazor\bin\Debug\net6.0\wwwroot\_framework\Acme.Blazor.dll' because it is being used by another process.  [D:\NET\Acme\src\Acme.Blazor\Acme.Blazor.csproj]
C:\Program Files\dotnet\sdk\6.0.200\Sdks\Microsoft.NET.Sdk.Razor\targets\Microsoft.NET.Sdk.Razor.StaticWebAssets.targets(363,5): warning MSB3026: Could not copy "obj\Debug\net6.0\Acme.Blazor.dll" to "D:\NET\Acme\src\Acme.Blazor\bin\Debug\net6.0\wwwroot\_framework/Acme.Blazor.dll". Beginning retry 8 in 1000ms. The process cannot access the file 'D:\NET\Acme\src\Acme.Blazor\bin\Debug\net6.0\wwwroot\_framework\Acme.Blazor.dll' because it is being used by another process.  [D:\NET\Acme\src\Acme.Blazor\Acme.Blazor.csproj]
C:\Program Files\dotnet\sdk\6.0.200\Sdks\Microsoft.NET.Sdk.Razor\targets\Microsoft.NET.Sdk.Razor.StaticWebAssets.targets(363,5): warning MSB3026: Could not copy "obj\Debug\net6.0\Acme.Blazor.dll" to "D:\NET\Acme\src\Acme.Blazor\bin\Debug\net6.0\wwwroot\_framework/Acme.Blazor.dll". Beginning retry 9 in 1000ms. The process cannot access the file 'D:\NET\Acme\src\Acme.Blazor\bin\Debug\net6.0\wwwroot\_framework\Acme.Blazor.dll' because it is being used by another process.  [D:\NET\Acme\src\Acme.Blazor\Acme.Blazor.csproj]
C:\Program Files\dotnet\sdk\6.0.200\Sdks\Microsoft.NET.Sdk.Razor\targets\Microsoft.NET.Sdk.Razor.StaticWebAssets.targets(363,5): warning MSB3026: Could not copy "obj\Debug\net6.0\Acme.Blazor.dll" to "D:\NET\Acme\src\Acme.Blazor\bin\Debug\net6.0\wwwroot\_framework/Acme.Blazor.dll". Beginning retry 10 in 1000ms. The process cannot access the file 'D:\NET\Acme\src\Acme.Blazor\bin\Debug\net6.0\wwwroot\_framework\Acme.Blazor.dll' because it is being used by another process.  [D:\NET\Acme\src\Acme.Blazor\Acme.Blazor.csproj]
C:\Program Files\dotnet\sdk\6.0.200\Sdks\Microsoft.NET.Sdk.Razor\targets\Microsoft.NET.Sdk.Razor.StaticWebAssets.targets(363,5): error MSB3027: Could not copy "obj\Debug\net6.0\Acme.Blazor.dll" to "D:\NET\Acme\src\Acme.Blazor\bin\Debug\net6.0\wwwroot\_framework/Acme.Blazor.dll". Exceeded retry count of 10. Failed.  [D:\NET\Acme\src\Acme.Blazor\Acme.Blazor.csproj]
C:\Program Files\dotnet\sdk\6.0.200\Sdks\Microsoft.NET.Sdk.Razor\targets\Microsoft.NET.Sdk.Razor.StaticWebAssets.targets(363,5): error MSB3021: Unable to copy file "obj\Debug\net6.0\Acme.Blazor.dll" to "D:\NET\Acme\src\Acme.Blazor\bin\Debug\net6.0\wwwroot\_framework/Acme.Blazor.dll". The process cannot access the file 'D:\NET\Acme\src\Acme.Blazor\bin\Debug\net6.0\wwwroot\_framework\Acme.Blazor.dll' because it is being used by another process. [D:\NET\Acme\src\Acme.Blazor\Acme.Blazor.csproj]

It seems some files can not be copied.We made sure VisualStudio is not running. We even tried restarting the PC and creating a fresh new ABP Commercial Application. But we get the same issue.

Do you have any suggestions to solve this problem?

Hi,

we are running an Xamarin-Forms app and we currently authenticate the app using an OIDC client. We are able to retrieve the access token from the auth-server (ABP Commercial).

We want to use the IProductAppService as an example on the mobile app. We created a AbpModule on the app that depends on the following modules: AbpAutofacModule, AbpHttpClientModule and ProductServiceApplicationContractsModule.

[DependsOn(
    typeof(AbpAutofacModule),
    typeof(AbpHttpClientModule),
    typeof(ProductServiceApplicationContractsModule)
    )]
public class Module : AbpModule
{
    public override void ConfigureServices(ServiceConfigurationContext context)
    {
        var services = context.Services;

        services.Configure<AbpHttpClientBuilderOptions>(options =>
        {
            options.ProxyClientActions.Add((name, p, c) =>
            {
                c.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", HeadersHandler.AccessToken);
            });
        });

        services.AddScoped<IHttpClientFactory>(s => new OurHttpClientFactory()));

        services.Configure<AbpRemoteServiceOptions>(options =>
        {
            options.RemoteServices.Default = new RemoteServiceConfiguration(Constants.BaseUrl);
        });

        services.AddHttpClientProxies(typeof(ProductServiceApplicationContractsModule).Assembly);
    }
}

Then we resolve for the service IProductAppService. The service is returned successfully.

Now, here are our problems:

1) When calling a method from the IProductAppService we get: System.Net.Http.HttpRequestException: The SSL connection could not be established.

We want to override the IHttpClientFactory that is consumed by the dynamic proxies so that we can disable the SSL validation on the mobile app side on the HttpClient.

We tried to add our implementation of the IHttpClientFactory interface in the module:

services.AddScoped<IHttpClientFactory>(s => new OurHttpClientFactory()));

But when we resolve the IProductAppService service, we received this exception:

Object reference not set to an instance of an object.

  at Volo.Abp.Http.Client.ClientProxying.ClientProxyBase`1[TService].get_ClientOptions () [0x00000] in D:\ci\Jenkins\workspace\abp-commercial-release\abp\framework\src\Volo.Abp.Http.Client\Volo\Abp\Http\Client\ClientProxying\ClientProxyBase.cs:36 
  at Volo.Abp.Http.Client.ClientProxying.ClientProxyBase`1[TService].RequestAsync (Volo.Abp.Http.Client.ClientProxying.ClientProxyRequestContext requestContext) [0x00030] in D:\ci\Jenkins\workspace\abp-commercial-release\abp\framework\src\Volo.Abp.Http.Client\Volo\Abp\Http\Client\ClientProxying\ClientProxyBase.cs:108 
  at Volo.Abp.Http.Client.ClientProxying.ClientProxyBase`1[TService].RequestAsync[T] (Volo.Abp.Http.Client.ClientProxying.ClientProxyRequestContext requestContext) [0x0003d] in D:\ci\Jenkins\workspace\abp-commercial-release\abp\framework\src\Volo.Abp.Http.Client\Volo\Abp\Http\Client\ClientProxying\ClientProxyBase.cs:76 
  at Volo.Abp.Http.Client.DynamicProxying.DynamicHttpProxyInterceptorClientProxy`1[TService].CallRequestAsync[T] (Volo.Abp.Http.Client.ClientProxying.ClientProxyRequestContext requestContext) [0x0002d] in D:\ci\Jenkins\workspace\abp-commercial-release\abp\framework\src\Volo.Abp.Http.Client\Volo\Abp\Http\Client\DynamicProxying\DynamicHttpProxyInterceptorClientProxy.cs:11 
  at Volo.Abp.Http.Client.DynamicProxying.DynamicHttpProxyInterceptor`1[TService].CallRequestAsync[T] (Volo.Abp.Http.Client.ClientProxying.ClientProxyRequestContext context) [0x00032] in D:\ci\Jenkins\workspace\abp-commercial-release\abp\framework\src\Volo.Abp.Http.Client\Volo\Abp\Http\Client\DynamicProxying\DynamicHttpProxyInterceptor.cs:92 
  at Volo.Abp.Http.Client.DynamicProxying.DynamicHttpProxyInterceptor`1[TService].GetResultAsync (System.Threading.Tasks.Task task, System.Type resultType) [0x0001f] in D:\ci\Jenkins\workspace\abp-commercial-release\abp\framework\src\Volo.Abp.Http.Client\Volo\Abp\Http\Client\DynamicProxying\DynamicHttpProxyInterceptor.cs:97 
  at Volo.Abp.Http.Client.DynamicProxying.DynamicHttpProxyInterceptor`1[TService].InterceptAsync (Volo.Abp.DynamicProxy.IAbpMethodInvocation invocation) [0x001a2] in D:\ci\Jenkins\workspace\abp-commercial-release\abp\framework\src\Volo.Abp.Http.Client\Volo\Abp\Http\Client\DynamicProxying\DynamicHttpProxyInterceptor.cs:71 
  at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter`1[TInterceptor].InterceptAsync[TResult] (Castle.DynamicProxy.IInvocation invocation, Castle.DynamicProxy.IInvocationProceedInfo proceedInfo, System.Func`3[T1,T2,TResult] proceed) [0x00059] in D:\ci\Jenkins\workspace\abp-commercial-release\abp\framework\src\Volo.Abp.Castle.Core\Volo\Abp\Castle\DynamicProxy\CastleAsyncAbpInterceptorAdapter.cs:29 
  at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult] (Castle.DynamicProxy.IInvocation invocation, Castle.DynamicProxy.IInvocationProceedInfo proceedInfo) [0x00079] in &lt;25225aa189ef4d0091cfe671f9159d35&gt;:0 
  at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue`1[TResult].ProceedAsync () [0x00038] in D:\ci\Jenkins\workspace\abp-commercial-release\abp\framework\src\Volo.Abp.Castle.Core\Volo\Abp\Castle\DynamicProxy\CastleAbpMethodInvocationAdapterWithReturnValue.cs:24 
  at Volo.Abp.Validation.ValidationInterceptor.InterceptAsync (Volo.Abp.DynamicProxy.IAbpMethodInvocation invocation) [0x0009c] in D:\ci\Jenkins\workspace\abp-commercial-release\abp\framework\src\Volo.Abp.Validation\Volo\Abp\Validation\ValidationInterceptor.cs:19 
  at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter`1[TInterceptor].InterceptAsync[TResult] (Castle.DynamicProxy.IInvocation invocation, Castle.DynamicProxy.IInvocationProceedInfo proceedInfo, System.Func`3[T1,T2,TResult] proceed) [0x00059] in D:\ci\Jenkins\workspace\abp-commercial-release\abp\framework\src\Volo.Abp.Castle.Core\Volo\Abp\Castle\DynamicProxy\CastleAsyncAbpInterceptorAdapter.cs:29 

So it is probably not intended to be used like this. How can we supply our own HttpClient. We need to set the HttpClientHandler of the HttpClient so that we can set the following (only for Debugging):

ServerCertificateCustomValidationCallback = DangerousAcceptAnyServerCertificateValidator;

2) How can we add the access token to the headers of the HttpClient consumed by the dynamic proxies?

This is our current solution:

services.Configure<AbpHttpClientBuilderOptions>(options =>
{
    options.ProxyClientActions.Add((name, p, c) =>
    {
        c.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", "<ACCESS-TOKEN>");
    });
});

Is this the recommended way or is there a better solution?

Showing 11 to 17 of 17 entries
Made with ❤️ on ABP v9.0.0-preview Updated on September 20, 2024, 08:30