Base solution for your next web application

Activities of "henriksorensen"

Hi,

I am trying to add a https (port 443) binding in IIS for the Angular site but I get an error saying "An Error Has Occurred"

I have checked the following:

  1. The backend is running and I am able to see the swagger ui
  2. The frontend appsettings.json is pointing to the correct port for the backend.
  3. The CorsOrigins are pointing to the https address

If I switch the Angular site back to http (port 80) I don't get the error.

I have tried to search the forums for similar problems but with no luck.

Can you provide a quick guide to enabling HTTPS for the Angular site?

Best regards Henrik

@rvanwoezik Thanks for your snippit for the url rewrite.

I found that there was a problem with the routing because the server that is hosting the application is in another domain that is not trusted. This caused some redirects to fail.

Thanks for the quick reply.

Hi

We have to access and update tables in two databases within same transaction scope. We have the same setup as described here, <a class="postlink" href="https://github.com/aspnetboilerplate/aspnetboilerplate/issues/2325">https://github.com/aspnetboilerplate/as ... ssues/2325</a>. Also we have changed database transaction strategy to DbContextEfTransactionStrategy as described in <a class="postlink" href="https://aspnetboilerplate.com/Pages/Documents/EntityFramework-Integration#transaction-management">https://aspnetboilerplate.com/Pages/Doc ... management</a>.

The metod public DbContext CreateDbContext<TDbContext>(string connectionString, IDbContextResolver dbContextResolver) is always called the default connectionstring and therefore the second dbcontext is never inserted into this.ActiveTransactions[connectionString].

Abp Version is 2.2.2

Regards,

  1. DbContext: public class SchemaStagingServiceDbContext : AbpZeroDbContext<Tenant, Role, User, SchemaStagingServiceDbContext> { public virtual DbSet<Schema> Schemas { get; set; } public SchemaStagingServiceDbContext(DbContextOptions<SchemaStagingServiceDbContext> options) : base(options) { } }

Add and configure DbContext in SchemaStagingServiceEntityFrameworkCoreModule public override void PreInitialize() { Configuration.ReplaceService<IEfCoreTransactionStrategy, DbContextEfCoreTransactionStrategy>(DependencyLifeStyle.Transient); if (!SkipDbContextRegistration) { Configuration.Modules.AbpEfCore().AddDbContext<SchemaStagingServiceDbContext>(configuration => { SchemaStagingServiceDbContextConfigurer.Configure(configuration.DbContextOptions, configuration.ConnectionString); }); } }

  1. DbContext: public class StagingDbContext : AbpDbContext { public virtual DbSet<Schemadata> Schemadata { get; set; } public StagingDbContext(DbContextOptions<StagingDbContext> options) : base(options) { } }

Add and configure DbContext in StagingInfrastructureModule public override void PreInitialize() { Configuration.ReplaceService<IEfCoreTransactionStrategy, DbContextEfCoreTransactionStrategy>(DependencyLifeStyle.Transient); if (!SkipDbContextRegistration) { Configuration.Modules.AbpEfCore().AddDbContext<StagingDbContext>(configuration => { StagingDbContextConfigurer.Configure(configuration.DbContextOptions, "Server=localhost; Database=Staging; Trusted_Connection=True; MultipleActiveResultSets=True;"); }); } }

Hi

I am calling a external rest service which returns a 404 error if query is not found. I would like to handle this error (and other errors) and not the default defaultError404 AbpHttpConfiguration.

this.ServiceProxy.apiV1Post(input)
                    .finally(() => { this.saving = false; })
                    .subscribe(() => {
                        this.notify.info(this.l('SavedSuccessfully'));
                        this.close();
                        this.modalSave.emit(null);
                    });

How to display custom error and prevent defaultError404 being called?

We call the exteranl service via serviceproxy generated by nswag.
It is a angular 5 +.net core project

I seen the "abpHandleError" setting but that seems to relate to a jquery project. Correct me if i am wrong.

Thanks, Henrik

@ismcagdas , thanks. I have upgraded abp-ng2-module to v2. I get some errors.

In root.modul.ts "ABP_HTTP_PROVIDER" is not found when

import { AbpModule , ABP_HTTP_PROVIDER } from '@abp/abp.module';
providers: [
        ABP_HTTP_PROVIDER,

In tenant-settings.component.ts and change-profile-picture-modal.component.ts should i replace 7

import { IAjaxResponse } from '@abp/abpHttp'; with
import { HttpInterceptor } from '@angular/common/http';

and replace const ajaxResponse = <IAjaxResponse>JSON.parse(response); with HttpInterceptor?

Can I download the above files somewhere or can past what to change. I am unsure what to change.

Thanks, Henrik

@ismcagdas

Thanks. I have made the necessary changes. The solution builds and i can go to localhost:4200 and i see the spinner but then nothing happens. In chrome developer the last successful request is to GetCurrentLoginInformations, then it hangs at <a class="postlink" href="ws://localhost:4200/sockjs-node/450/g15t5ui3/websocket">ws://localhost:4200/sockjs-node/450/g15t5ui3/websocket</a>.

@ismcagdas

Yes I have regenerate service-proxies by doing "../angular/nswag/refresh.bat" and have also modified service-proxies.module.ts like your commit.

@ismcagdas

Just want to let you know I have fixed my upgrade problem. Did a upgrade from 5.1.0 to 5.2.0.

Thanks, Henrik

Product Version 9.1 Angular .Net Core ABP version 51.5

<br> And I am unable to configure the grant type / Response type in the OpenId configuring section. I'm able to configure ClientId, Client Secret etc. but not grant type. I want use Granttype = code. It looks like Angular is using grant type = "hybrid" by default. Please confirm?

I'm able to configure/code the same in the .Web.Startup.AuthConfigurer class in the MVC version of Asp.Net Zero (my demo solution). Like this

authenticationBuilder.AddOpenIdConnect(options => { options.ClientId = configuration["Authentication:OpenId:ClientId"]; options.Authority = configuration["Authentication:OpenId:Authority"]; options.SignedOutRedirectUri = configuration["App:WebSiteRootAddress"] + "Account/Logout"; options.ResponseType = OpenIdConnectResponseType.Code; // Grantstype = code

But I can't find a similar way for the angular solution? Please assist

Best regards Tom

My Configuration:

AllowSocialLoginSettingsPerTenant = true and "OpenId": { "IsEnabled": "true", "Authority": "https://localhost:44313", "LoginUrl": "https://localhost:44313/Account/Login?", "ClientId": "my-webclient", "ClientSecret": "XYZ", "ValidateIssuer": "false", "ClaimsMapping": [ { "claim": "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier", "key": "http://schemas.microsoft.com/identity/claims/objectidentifier" } ] },

IdentityServer4 3.1 running on "https://localhost: 44313" with "my-webclient" like this "AllowedGrantTypes": [ "authorization_code" ], "RequirePkce": true,

Showing 1 to 10 of 15 entries