Hi,
I created a new M/S Solution on 5.1.4 so I did not have to migrate anything. It just doesn't work when trying to create unit tests in the Identity Service or the Administration Service.
The problem is the samples are commented out so there aren't any tests. If you run the Product Service App Tests it works fine.
Hi,
I have run the IdentityService and the AdministrationService xUnit Tests in a new solution on 5.1.4 and they both fail with a Test Host Crashed. The Product Service Test Examples work just fine.
C:\Development\apb5.1.4\MyTestApp\services\administration\test\MyTestApp.AdministrationService.Application.Tests\Samples\SampleAppService_Tests.cs
Please could we get some assistance with this.
using System.Threading.Tasks;
using Xunit;
namespace DataAdmiral.IdentityService.Samples;
public class SampleAppService_Tests : IdentityServiceDomainTestBase
{
//private readonly ISampleAppService _sampleAppService;
public SampleAppService_Tests()
{
//_sampleAppService = GetRequiredService<ISampleAppService>();
}
[Fact]
public async Task Method1Async()
{
}
}
Starting test execution, please wait...
A total of 1 test files matched the specified pattern.
The active test run was aborted. Reason: Test host process crashed
Test Run Aborted with error System.Exception: One or more errors occurred.
---> System.Exception: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host..
---> System.Exception: An existing connection was forcibly closed by the remote host.
at System.Net.Sockets.NetworkStream.Read(Span`1 buffer)
--- End of inner exception stack trace ---
at System.Net.Sockets.NetworkStream.Read(Span`1 buffer)
at System.Net.Sockets.NetworkStream.ReadByte()
at System.IO.BinaryReader.Read7BitEncodedInt()
at System.IO.BinaryReader.ReadString()
at Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.LengthPrefixCommunicationChannel.NotifyDataAvailable()
at Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.TcpClientExtensions.MessageLoopAsync(TcpClient client, ICommunicationChannel channel, Action`1 errorHandler, CancellationToken cancellationToken)
--- End of inner exception stack trace ---.
We are planning a new release (5.1.4) on 28.02.2022.
As a workaround, you can update your related
MyServiceEntityFrameworkCoreTestModule
:Configure<AbpDbContextOptions>(options => { options.Configure(abpDbContextConfigurationContext => { abpDbContextConfigurationContext.DbContextOptions.UseSqlite(sqliteConnection); }); });
to
Configure<AbpDbContextOptions>(options => { options.Configure<MyDbContext>(abpDbContextConfigurationContext => { abpDbContextConfigurationContext.DbContextOptions.UseSqlite(sqliteConnection); }); });
thanks gterdem. The above work-around works for most modules except for the administration service module. We followed the below steps and it still errors out,
This shows this error in Tests (output) window - The active test run was aborted. Reason: Test host process crashed
I get the below error when I try to run the same test in command prompt using 'dotnet test' - Can you please help?
The active test run was aborted. Reason: Test host process crashed
Test Run Aborted with error System.Exception: One or more errors occurred. ---> System.Exception: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.. ---> System.Exception: An existing connection was forcibly closed by the remote host. at System.Net.Sockets.NetworkStream.Read(Span
1 buffer) --- End of inner exception stack trace --- at System.Net.Sockets.NetworkStream.Read(Span
1 buffer) at System.Net.Sockets.NetworkStream.ReadByte() at System.IO.BinaryReader.Read7BitEncodedInt() at System.IO.BinaryReader.ReadString() at Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.LengthPrefixCommunicationChannel.NotifyDataAvailable() at Microsoft.VisualStudio.TestPlatform.CommunicationUtilities.TcpClientExtensions.MessageLoopAsync(TcpClient client, ICommunicationChannel channel, Action`1 errorHandler, CancellationToken cancellationToken) --- End of inner exception stack trace ---
Thanks for the ticket refund. It puts in a really awkward spot when practicing TDD
Thanks for the pointer we were able to get this working by using the Sign In Manager
ABP Framework version: v5.1.3 UI type: MVC / Blazor DB provider: EF Core Tiered (MVC) or Identity Server Separated (Angular): Blazor Server Microservices
Expected Behaviour
The Unit Tests would use SQLite In-Memory repository and pass first time out of the box.
Actual Behaviour
The Unit Tests fail and always try to use SQL Server
Steps to reproduce the issue
Summary
We have also tested this against all other unit tests and its the same behaviour as the example product service. Even for new microservice modules added later.
Images below show where there are references to the EF SQL Server Module in the Test base classes.
And this is where it crashes trying to setup a connection
We have spent a good couple of days going through examples and docs and trying to figure out why this does not work. Please could you help us fix this as it should really work out of the box.
Thanks
ABP Framework version: v5.1.3 UI type: MVC / Blazor Server DB provider: EF Core Tiered (MVC) or Identity Server Separated (Angular): Blazor Server Microservices
Hi,
Where is the best place to inject an IP Address authorization check in the stack when using a Blazor Web Server App in Microservices? Please could you point us in the right direction?
IP restrictions are at a Tenant Level so the user would have to Authenticate and then have their IP checked against a whitelist in their Tenant. Or we resolve the Tenant first and check the IP Address whitelist and if passed allow the user authentication to proceed.
I have also looked at https://docs.microsoft.com/en-us/aspnet/core/security/ip-safelist?view=aspnetcore-6.0 and https://www.blogofpi.com/restrict-ip-address-in-asp-net-web-api/
We just can't quite find out where to inject it in the APB solution.
Thanks
Toby.
What is the significance of the block of code in the Auth Server, it doesn't run if it is in development mode, however it still works if it's in development mode.
When is not in development mode i.e. Staging/Release is it creating a new local host certificate to use here, should we be using a proper signing cert here, what's it used for?
There is very little documentation on prepping this for a production deployment.Brifiely mentioned here https://docs.abp.io/en/commercial/5.0/startup-templates/microservice/applications#deployment-configurations
Thanks
Hi,
We are using the Microservices Template on APB 5.1.3. and have encountered an issue when deploying to a Linux container.
On container startup, we get the following issue:-
Volo.Abp.AbpInitializationException: An error occurred during ConfigureServicesAsync phase of the module Volo.Abp.IdentityServer.AbpIdentityServerDomainModule, Volo.Abp.IdentityServer.Domain, Version=5.1.3.0, Culture=neutral, PublicKeyToken=null. See the inner exception for details.
---> System.Security.Cryptography.CryptographicException: The certificate data cannot be read with the provided password, the password may be incorrect.
---> System.Security.Cryptography.CryptographicException: The certificate data cannot be read with the provided password, the password may be incorrect.
at Internal.Cryptography.Pal.UnixPkcs12Reader.VerifyAndDecrypt(ReadOnlySpan`1 password, ReadOnlyMemory`1 authSafeContents)
at Internal.Cryptography.Pal.UnixPkcs12Reader.Decrypt(SafePasswordHandle password, Boolean ephemeralSpecified)
--- End of inner exception stack trace ---
at Internal.Cryptography.Pal.UnixPkcs12Reader.Decrypt(SafePasswordHandle password, Boolean ephemeralSpecified)
at Internal.Cryptography.Pal.PkcsFormatReader.TryReadPkcs12(OpenSslPkcs12Reader pfx, SafePasswordHandle password, Boolean single, Boolean ephemeralSpecified, ICertificatePal& readPal, List`1& readCerts)
at Internal.Cryptography.Pal.PkcsFormatReader.TryReadPkcs12(ReadOnlySpan`1 rawData, SafePasswordHandle password, Boolean single, Boolean ephemeralSpecified, ICertificatePal& readPal, List`1& readCerts, Exception& openSslException)
at Internal.Cryptography.Pal.OpenSslX509CertificateReader.FromFile(String fileName, SafePasswordHandle password, X509KeyStorageFlags keyStorageFlags)
at System.Security.Cryptography.X509Certificates.X509Certificate..ctor(String fileName, String password, X509KeyStorageFlags keyStorageFlags)
at System.Security.Cryptography.X509Certificates.X509Certificate2..ctor(String fileName, String password, X509KeyStorageFlags keyStorageFlags)
at DataAdmiral.AuthServer.DataAdmiralAuthServerModule.GetSigningCertificate(IWebHostEnvironment hostingEnv, IConfiguration configuration) in /src/apps/auth-server/src/DataAdmiral.AuthServer/DataAdmiralAuthServerModule.cs:line 93
at DataAdmiral.AuthServer.DataAdmiralAuthServerModule.<>c__DisplayClass0_0.<PreConfigureServices>b__1(IIdentityServerBuilder builder) in /src/apps/auth-server/src/DataAdmiral.AuthServer/DataAdmiralAuthServerModule.cs:line 76
at Volo.Abp.Options.PreConfigureActionList`1.Configure(TOptions options)
at Microsoft.Extensions.DependencyInjection.ServiceCollectionPreConfigureExtensions.ExecutePreConfiguredActions[TOptions](IServiceCollection services, TOptions options)
at Volo.Abp.IdentityServer.AbpIdentityServerDomainModule.AddIdentityServer(IServiceCollection services)
at Volo.Abp.IdentityServer.AbpIdentityServerDomainModule.ConfigureServices(ServiceConfigurationContext context)
at Volo.Abp.Modularity.AbpModule.ConfigureServicesAsync(ServiceConfigurationContext context)
at Volo.Abp.AbpApplicationBase.ConfigureServicesAsync()
--- End of inner exception stack trace ---
at Volo.Abp.AbpApplicationBase.ConfigureServicesAsync()
at Volo.Abp.AbpApplicationFactory.CreateAsync[TStartupModule](IServiceCollection services, Action`1 optionsAction)
at Microsoft.Extensions.DependencyInjection.ServiceCollectionApplicationExtensions.AddApplicationAsync[TStartupModule](IServiceCollection services, Action`1 optionsAction)
at Microsoft.Extensions.DependencyInjection.WebApplicationBuilderExtensions.AddApplicationAsync[TStartupModule](WebApplicationBuilder builder, Action`1 optionsAction)
at DataAdmiral.AuthServer.Program.Main(String[] args) in /src/apps/auth-server/src/DataAdmiral.AuthServer/Program.cs:line 27
It cannot read the PFX file that has been generated by .NET.
Please could you look into this
Thanks