Check the docs before asking a question: https://docs.abp.io/en/commercial/latest/ Check the samples, to see the basic tasks: https://docs.abp.io/en/commercial/latest/samples/index The exact solution to your question may have been answered before, please use the search on the homepage.
We are looking to deploy our application on an IIS web server which is behind a load balancer with SSL terminated at the load balancer. This is a common deployment strategy for our clients. I am testing this setup with a prototype (single set of CRUD pages) generated using Suite 4.0.0 and later upgraded to 4.0.2.
Question: Does the API require a separate website or can I deploy it as an application within a website? Ideally, I want to deploy the API and the Angular client as as single website, but this isn't going to work if the API must be deployed at the root of a website. Normally, I would create a webite and then deploy the Angular client at the root and the API as a sub application within the website.
2021-01-12 15:54:35.018 +00:00 [INF] Hosting environment: Production 2021-01-12 15:54:35.018 +00:00 [INF] Content root path: {location}\Portal.Api 2021-01-12 15:54:35.036 +00:00 [INF] Request starting HTTP/1.1 GET http://{mywebsite}/portal-prototype-api/Account/Login?ReturnUrl=%2Fportal-prototype-api - - 2021-01-12 15:54:36.956 +00:00 [INF] Executing endpoint '/Account/Login' 2021-01-12 15:54:37.026 +00:00 [INF] Route matched with {page = "/Account/Login", action = "", controller = "", area = ""}. Executing page /Account/Login 2021-01-12 15:54:37.028 +00:00 [INF] Skipping the execution of current filter as its not the most effective filter implementing the policy Microsoft.AspNetCore.Mvc.ViewFeatures.IAntiforgeryPolicy 2021-01-12 15:54:37.795 +00:00 [INF] Executing handler method Volo.Abp.Account.Public.Web.Pages.Account.LoginModel.OnGetAsync - ModelState is "Valid" 2021-01-12 15:54:37.819 +00:00 [INF] Executed handler method OnGetAsync, returned result . 2021-01-12 15:54:37.822 +00:00 [INF] Executing an implicit handler method - ModelState is "Valid" 2021-01-12 15:54:37.822 +00:00 [INF] Executed an implicit handler method, returned result Microsoft.AspNetCore.Mvc.RazorPages.PageResult. 2021-01-12 15:54:38.006 +00:00 [ERR] An exception was thrown while deserializing the token. Microsoft.AspNetCore.Antiforgery.AntiforgeryValidationException: The antiforgery token could not be decrypted. ---> System.Security.Cryptography.CryptographicException: The key {ac856cb7-2721-43c2-820b-6df7287dbb9a} was not found in the key ring. at Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingBasedDataProtector.UnprotectCore(Byte[] protectedData, Boolean allowOperationsOnRevokedKeys, UnprotectStatus& status) at Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingBasedDataProtector.DangerousUnprotect(Byte[] protectedData, Boolean ignoreRevocationErrors, Boolean& requiresMigration, Boolean& wasRevoked) at Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingBasedDataProtector.Unprotect(Byte[] protectedData) at Microsoft.AspNetCore.Antiforgery.DefaultAntiforgeryTokenSerializer.Deserialize(String serializedToken) --- End of inner exception stack trace --- at Microsoft.AspNetCore.Antiforgery.DefaultAntiforgeryTokenSerializer.Deserialize(String serializedToken) at Microsoft.AspNetCore.Antiforgery.DefaultAntiforgery.GetCookieTokenDoesNotThrow(HttpContext httpContext) 2021-01-12 15:54:38.190 +00:00 [WRN] The cookie 'XSRF-TOKEN' has set 'SameSite=None' and must also set 'Secure'.
Upgrading to version 4.0.2 and recreating the project fixed the issue
After being directed to this from https://support.abp.io/QA/Questions/626/Bugs--Issues-v4X#answer-756752d8-cea0-580d-5ede-39f9883c69d9
which directed me to a proposed temporary solution at https://support.abp.io/QA/Questions/626/Bugs--Issues-v4X#answer-756752d8-cea0-580d-5ede-39f9883c69d9
I added the resolution section to packages.json, deleted the yarn.lock file, ran yarn and deleted all local cookies and storage.
The behaviour of the application has not changed, but I get a different error message.
I am having issues getting the angular web client to work when creating a new solution with Suite 4.0.1.
Steps to reproduce.
This does not happen with projects created with Suite 3.3.1.
Adding the [Authorize] attribute on the home controller eliminates the need to manually navigate to the login page. Since the Swagger UI cannot be used without logging in, you might as well add Authorize.
Ok. That works, but it is not obvious. Why not implement the Security Definition and Security Requirements for Swagger in the default template?
Check the docs before asking a question: https://docs.abp.io/en/commercial/latest/ Check the samples, to see the basic tasks: https://docs.abp.io/en/commercial/latest/samples/index The exact solution to your question may have been answered before, please use the search on the homepage.
ABP Framework version: v4.0.0
UI type: Angular
Tiered (MVC) or Identity Server Seperated (Angular): no
Steps to reproduce the issue:
abp new Acme.BookStore -u angular -m none -csf
build the solution
run dbmigrator project
run httpapi.host project
there is no login button shown on the swagger api // attempting to use the /api/account/login post endpoint to login gives an error
Exception message and stack trace: 2020-12-10 12:05:25.045 -05:00 [DBG] Error Url: /Account/Error 2020-12-10 12:05:25.045 -05:00 [DBG] Error Id Parameter: errorId 2020-12-10 12:05:25.049 -05:00 [ERR] The required antiforgery cookie ".AspNetCore.Antiforgery.gYxNi6c7Ut0" is not present. 2020-12-10 12:05:25.050 -05:00 [INF] Authorization failed for the request at filter 'Volo.Abp.AspNetCore.Mvc.AntiForgery.AbpAutoValidateAntiforgeryTokenAuthorizationFilter'. 2020-12-10 12:05:25.054 -05:00 [INF] Executing HttpStatusCodeResult, setting HTTP status code 400
There are related tickets/pull requests which were closed indicating this is in v4.0, but testing indicates otherwise
Here is the list of packages from my Application project. Keep in mind, we are not using MongoDb.
<ItemGroup>
<PackageReference Include="Volo.Abp.Account.Pro.Shared.Application" Version="3.3.1" />
<PackageReference Include="Volo.Abp.PermissionManagement.Application" Version="3.3.1" />
<PackageReference Include="Volo.Abp.FeatureManagement.Application" Version="3.3.1" />
<PackageReference Include="Volo.Saas.Host.Application" Version="3.3.1" />
<PackageReference Include="Volo.Abp.AuditLogging.Application" Version="3.3.1" />
<PackageReference Include="Volo.Abp.Identity.Pro.Application" Version="3.3.1" />
<PackageReference Include="Volo.Abp.IdentityServer.Application" Version="3.3.1" />
<PackageReference Include="Volo.Abp.Account.Pro.Public.Application" Version="3.3.1" />
<PackageReference Include="Volo.Abp.Account.Pro.Admin.Application" Version="3.3.1" />
<PackageReference Include="Volo.Abp.LanguageManagement.Application" Version="3.3.1" />
<PackageReference Include="Volo.Abp.TextTemplateManagement.Application" Version="3.3.1" />
<PackageReference Include="Volo.Abp.LeptonTheme.Management.Application" Version="3.3.1" />
</ItemGroup>
I commented out all tests and then started adding tests 1 at a time. The process works for 2 tests (any two), but the process starts showing errors when adding a 3rd test (any item). With 3 tests, it works sometimes and fails others. Very inconsistent, but it fails more than it succeeds. Adding a 4th test caused it to fail every time.
An example test case is shown below
public class ClassificationSubcategoryAppServiceTests : SynergyzApplicationTestBase
{
private readonly IClassificationSubcategoryAppService _classificationSubcategoryAppService;
private readonly IRepository<ClassificationSubcategory, int> _classificationSubcategoryRepository;
public ClassificationSubcategoryAppServiceTests()
{
_classificationSubcategoryAppService = GetRequiredService<IClassificationSubcategoryAppService>();
_classificationSubcategoryRepository = GetRequiredService<IRepository<ClassificationSubcategory, int>>();
}
[Fact]
public async Task GetListAsync()
{
// Act
var result = await _classificationSubcategoryAppService.GetListAsync(new GetClassificationSubcategoriesInput());
// Assert
result.TotalCount.ShouldBe(2);
result.Items.Count.ShouldBe(2);
result.Items.Any(x => x.Id == 2069964284).ShouldBe(true);
result.Items.Any(x => x.Id == 268848218).ShouldBe(true);
}
[Fact]
public async Task GetAsync()
{
// Act
var result = await _classificationSubcategoryAppService.GetAsync(2069964284);
// Assert
result.ShouldNotBeNull();
result.Id.ShouldBe(2069964284);
}
[Fact]
public async Task CreateAsync()
{
// Arrange
var input = new ClassificationSubcategoryCreateDto
{
Name = "b8aa10058749413fae20f5b21834f142e59c87e73ce8405d84ba798226f9eaed1a01fc330d1a4d91be561a465f9a47416045dfe08b7244ecbab46087feebdee2b5736e43a58846d78e1562a9ea5184caa69534d8d5174b0cb9ec4aede460d6f02d7f18040bd14bf8b69c8d2a6c8a68d575b65716869c4a0aa7e3a1683595dbd",
Definition = "989",
CedsFlag = true
};
// Act
var serviceResult = await _classificationSubcategoryAppService.CreateAsync(input);
// Assert
var result = await _classificationSubcategoryRepository.FindAsync(c => c.Id == serviceResult.Id);
result.ShouldNotBe(null);
result.Name.ShouldBe("b8aa10058749413fae20f5b21834f142e59c87e73ce8405d84ba798226f9eaed1a01fc330d1a4d91be561a465f9a47416045dfe08b7244ecbab46087feebdee2b5736e43a58846d78e1562a9ea5184caa69534d8d5174b0cb9ec4aede460d6f02d7f18040bd14bf8b69c8d2a6c8a68d575b65716869c4a0aa7e3a1683595dbd");
result.Definition.ShouldBe("989");
result.CedsFlag.ShouldBe(true);
}
[Fact]
public async Task UpdateAsync()
{
// Arrange
var input = new ClassificationSubcategoryUpdateDto()
{
Name = "9eb166489eb44c869edebebd65472cabd7abbdb868f44c22b6e2f236b6297a49366cab5647944c9a93bb7c892580f81310d6952b0a0d4b99a085f3e528eda76974d6586f55724aa6ac7545b0629885be4c5aeac1d89d46d190ae3e5ebf40d5b5ce5316e81da3466c931807bac703a899c9021cc6e867497191522bd8e0355d1",
Definition = "58f",
CedsFlag = true
};
// Act
var serviceResult = await _classificationSubcategoryAppService.UpdateAsync(2069964284, input);
// Assert
var result = await _classificationSubcategoryRepository.FindAsync(c => c.Id == serviceResult.Id);
result.ShouldNotBe(null);
result.Name.ShouldBe("9eb166489eb44c869edebebd65472cabd7abbdb868f44c22b6e2f236b6297a49366cab5647944c9a93bb7c892580f81310d6952b0a0d4b99a085f3e528eda76974d6586f55724aa6ac7545b0629885be4c5aeac1d89d46d190ae3e5ebf40d5b5ce5316e81da3466c931807bac703a899c9021cc6e867497191522bd8e0355d1");
result.Definition.ShouldBe("58f");
result.CedsFlag.ShouldBe(true);
}
[Fact]
public async Task DeleteAsync()
{
// Act
await _classificationSubcategoryAppService.DeleteAsync(2069964284);
// Assert
var result = await _classificationSubcategoryRepository.FindAsync(c => c.Id == 2069964284);
result.ShouldBeNull();
}
}
The project was created using ABP Suite version 3.1 and then upgraded to 3.3.1. Creating a sample project using the 3.3 framework does not seem to reproduce the problem.