Base solution for your next web application

Activities of "affern"

Hello.

I'm trying to update my angular-aspnetzero solution from angular 5 to angular 6. The solution is compiling successfully, but my services are not working anymore. The result return null, but i can see my api is working if i open the api url in a new tab. My servies is like this:

this._surveyStatisticsService.getCategoryChart(this.siteId, this.siteTypeId, this.cookieLangValue).subscribe((result) => { this.categoryList = result; }

Question

Hi again guys. I have created a domain class with a composite keys:

    public class MultiAnswer 
    {

        [Key]
        [Column(Order = 1)]
        public long SurveyId { get; set; }
        [Key]
        [Column(Order = 2)]
        public long UserId { get; set; }
     
        [Key]
        [Column(Order = 3)]
        public int ItemId { get; set; }
      
        [Required]       
        public int AnswerId { get; set; }
                       
        public DateTime DateAnswer { get; set; }
        
        [ForeignKey("SurveyId")]
        public virtual Survey Survey { get; set; }

    }

But how do I declare a MultiAnswer Repository with 3 keys? The IRepository is for one primary key.

Hello guys.

My Asp.Net Zero solution, https://www.votecha.com has Angular 4 as a client app and run in Azure. But on first time visits the page load very slow.

I have developed a public modul after the same pattern as the account module. In the code the public module is set to lazy load like the account module.

I wonder if you have any tips on how I can reduce "the first visit" response time? Should I try to preload the public module? If so, how can I do this? Or is there other solutions I should try?

I know I can optimize my queries and also use Azure Redis cache, but it is mainly the first visit loading that is the problem.

This is my code in root-routing.module.ts:

import { NgModule } from '@angular/core';
import { Routes, RouterModule, Router, NavigationEnd } from '@angular/router';

const routes: Routes = [
    { path: '', redirectTo: '/app/main/mysite', pathMatch: 'full' },
    {
        path: 'account',
        loadChildren: 'account/account.module#AccountModule', //Lazy load account module
        data: { preload: true }
    },
    {
        path: 'public',
        loadChildren: 'public/public.module#PublicModule', //Lazy load public module
        data: { preload: true }
    }
];

@NgModule({
    imports: [RouterModule.forRoot(routes)],
    exports: [RouterModule],
    providers: []
})
export class RootRoutingModule {
    constructor(private router: Router) {
        router.events.subscribe((event: NavigationEnd) => {
            setTimeout(() => {
                this.toggleBodyCssClass(event.url);
            }, 0);
        });
    }

    toggleBodyCssClass(url: string): void {
        if (url) {

            if (url === '/') {
                if (abp.session.userId > 0) {
                    $('body').attr('class', 'page-md page-header-fixed page-sidebar-closed-hide-logo');
                } else {
                    $('body').attr('class', 'page-md login');
                }
            }

            if (url.indexOf("/account/") >= 0) {
                $('body').attr('class', 'page-md login');
            }
            else if (url.indexOf("/public") >= 0) {
                if (abp.session.userId > 0) {
                    $('body').attr('class', 'page-md page-header-fixed page-sidebar-closed-hide-logo');
                } else {
                    $('body').attr('class', 'page-md login');
                }
            }
            else {
                $('body').attr('class', 'page-md page-header-fixed page-sidebar-closed-hide-logo');
            }
        }
    }
}

Hello.

I wonder if anyone here using Google Adsense together with AspNetZero? I'm trying to use ng2-adsense (https://www.npmjs.com/package/ng2-adsense) since I have an Angular solution, but I'm not able to get it to work.

Is it ok to put this code in the head tags in the index.html file? <div class="highlight"><pre class="editor editor-colors"><div class="line"><span class="text html"><span class="meta tag any html"><span class="punctuation definition tag html"><span><</span></span><span class="entity name tag html"><span>script</span></span><span> </span><span class="entity other attribute-name html"><span>async</span></span><span> </span><span class="entity other attribute-name html"><span>src</span></span><span>=</span><span class="string unquoted html"><span>//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js</span></span><span class="punctuation definition tag html"><span>></span><span class="meta scope html"><span><</span></span><span>/</span></span><span class="entity name tag html"><span>script</span></span><span class="punctuation definition tag html"><span>></span></span></span></span></div></pre></div>

Hello

I'm trying to install owl-carousel in my solution but I get error message Property 'owlCarousel' does not exist on type 'JQuery'. If i put this code in typings.d.ts: interface JQuery { owlCarousel(...any): any; }

then I get this error: TypeError: owl.owlCarousel is not a function I have this code in my component:

import * as $ from 'jquery'; import 'owl.carousel/dist/assets/owl.carousel.css'; import 'owl.carousel';

export class SiteComponent extends AppComponentBase implements OnInit, AfterViewInit { @ViewChild('owl') owl: ElementRef;

ngAfterViewInit() { $(this.owl.nativeElement).owlCarousel(); }

.angular-cli.json:

"styles": ["../node_modules/owl.carousel/dist/assets/owl.theme.default.css"] "scripts": ["../node_modules/jquery/dist/jquery.js", "../node_modules/owl.carousel/dist/owl.carousel.js" ],

        Any ideas? 
Question

Hello I wonder if you have ever tried to run a volume test on the aspnetzero solution? How many million users can I expect the solution to handle? :)

I tried to insert a loop that created users in the HostRoleAndUserCreator class, but if I use a loop greater than 100, the script or VS starts hanging. Maybe I have to create a stored procedure in Sql server?

Hello. I'm trying to configure social logins for Facebook and Google. In Facebook I have to fill out an uri for "Valid OAuth Redirect URI" and the same for Google (Authorized redirect URI). Is there any angular component I have to put in this Uri? In Google's field it is an example "http://www.example.com/oauth2callback". Do you have an example uri for aspnetzero? Is it <a class="postlink" href="https://mydomain.com/account/login">https://mydomain.com/account/login</a>?

Now I get this error message: URL Blocked: This redirect failed because the redirect URI is not whitelisted in the app’s Client OAuth Settings. Make sure Client and Web OAuth Login are on and add all your app domains as Valid OAuth Redirect URIs.

On this page <a class="postlink" href="https://docs.microsoft.com/en-us/azure/app-service/app-service-mobile-how-to-configure-facebook-authentication">https://docs.microsoft.com/en-us/azure/ ... entication</a> it says: Your redirect URI is the URL of your application appended with the path, /.auth/login/facebook/callback. For example, <a class="postlink" href="https://contoso.azurewebsites.net/.auth/login/facebook/callback">https://contoso.azurewebsites.net/.auth ... k/callback</a>. Make sure that you are using the HTTPS scheme.

But it does not work.

Error in browser:

glyphicons-halflings-regular.woff2:1 Failed to load resource: the server responded with a status of 404 (Not Found) fontawesome-webfont.af7ae505a9eed503f8b8.woff2:1 Failed to load resource: the server responded with a status of 404 (Not Found) mysitewebhost.azurewebsites.net/api/TokenAuth/ExternalAuthenticate:1 POST <a class="postlink" href="https://mysitewebhost.azurewebsites.net/api/TokenAuth/ExternalAuthenticate">https://mysitewebhost.azurewebsites.net ... thenticate</a> 500 (Internal Server Error) abp.js:350 ERROR: abp.js:350 {code: 0, message: "An internal error occurred during your request!", details: null, validationErrors: null}code: 0details: nullmessage: "An internal error occurred during your request!"validationErrors: null__proto__: Object core.js:1440 ERROR {code: 0, message: "An internal error occurred during your request!", details: null, validationErrors: null} defaultErrorLogger @ core.js:1440 webpackJsonp.../../../core/esm5/core.js.ErrorHandler.handleError @ core.js:1501 next @ core.js:5491 schedulerFn @ core.js:4319 webpackJsonp.../../../../rxjs/_esm5/Subscriber.js.SafeSubscriber.__tryOrUnsub @ Subscriber.js:240 webpackJsonp.../../../../rxjs/_esm5/Subscriber.js.SafeSubscriber.next @ Subscriber.js:187 webpackJsonp.../../../../rxjs/_esm5/Subscriber.js.Subscriber._next @ Subscriber.js:128 webpackJsonp.../../../../rxjs/_esm5/Subscriber.js.Subscriber.next @ Subscriber.js:92 webpackJsonp.../../../../rxjs/_esm5/Subject.js.Subject.next @ Subject.js:56 webpackJsonp.../../../core/esm5/core.js.EventEmitter.emit @ core.js:4299 (anonymous) @ core.js:4755 webpackJsonp.../../../../zone.js/dist/zone.js.ZoneDelegate.invoke @ zone.js:365 webpackJsonp.../../../../zone.js/dist/zone.js.Zone.run @ zone.js:125 webpackJsonp.../../../core/esm5/core.js.NgZone.runOutsideAngular @ core.js:4681 onHandleError @ core.js:4755 webpackJsonp.../../../../zone.js/dist/zone.js.ZoneDelegate.handleError @ zone.js:369 webpackJsonp.../../../../zone.js/dist/zone.js.Zone.runTask @ zone.js:168 ZoneTask.invoke @ zone.js:460 load (async) invokeAddFunc @ zone.js:1364 scheduleEventListener @ zone.js:1416 webpackJsonp.../../../../zone.js/dist/zone.js.ZoneDelegate.scheduleTask @ zone.js:384 onScheduleTask @ zone.js:274 webpackJsonp.../../../../zone.js/dist/zone.js.ZoneDelegate.scheduleTask @ zone.js:378 webpackJsonp.../../../../zone.js/dist/zone.js.Zone.scheduleTask @ zone.js:209 webpackJsonp.../../../../zone.js/dist/zone.js.Zone.scheduleEventTask @ zone.js:235 zoneAwareAddListener @ zone.js:1462 addEventListener @ VM2258:3 (anonymous) @ http.js:1638 webpackJsonp.../../../../rxjs/_esm5/Observable.js.Observable._trySubscribe @ Observable.js:172 webpackJsonp.../../../../rxjs/esm5/Observable.js.Observable.subscribe @ Observable.js:160 webpackJsonp.../../../../rxjs/esm5/operators/map.js.MapOperator.call @ map.js:57 webpackJsonp.../../../../rxjs/esm5/Observable.js.Observable.subscribe @ Observable.js:157 webpackJsonp.../../../../rxjs/esm5/operators/catchError.js.CatchOperator.call @ catchError.js:80 webpackJsonp.../../../../rxjs/esm5/Observable.js.Observable.subscribe @ Observable.js:157 webpackJsonp.../../../../rxjs/esm5/operators/mergeMap.js.MergeMapOperator.call @ mergeMap.js:92 webpackJsonp.../../../../rxjs/esm5/Observable.js.Observable.subscribe @ Observable.js:157 webpackJsonp.../../../../rxjs/esm5/operators/catchError.js.CatchOperator.call @ catchError.js:80 webpackJsonp.../../../../rxjs/esm5/Observable.js.Observable.subscribe @ Observable.js:157 webpackJsonp.../../../../../src/account/login/login.service.ts.LoginService.facebookLoginStatusChangeCallback @ login.service.ts:255 (anonymous) @ login.service.ts:209 a.__wrapper.a.__wrapper @ sdk.js?=1525641212954:108 inform @ sdk.js?=1525641212954:58 a @ sdk.js?=1525641212954:105 (anonymous) @ sdk.js?=1525641212954:105 (anonymous) @ sdk.js?=1525641212954:105 N @ sdk.js?=1525641212954:103 (anonymous) @ sdk.js?=1525641212954:93 (anonymous) @ sdk.js?=1525641212954:54 (anonymous) @ sdk.js?=1525641212954:54 webpackJsonp.../../../../zone.js/dist/zone.js.ZoneDelegate.invokeTask @ zone.js:398 onInvokeTask @ core.js:4724 webpackJsonp.../../../../zone.js/dist/zone.js.ZoneDelegate.invokeTask @ zone.js:397 webpackJsonp.../../../../zone.js/dist/zone.js.Zone.runTask @ zone.js:165 ZoneTask.invoke @ zone.js:460 postMessage (async) e @ 2VRzCA39w_9.js?version=42:55 send @ 2VRzCA39w_9.js?version=42:55 window.proxyMessage @ 2VRzCA39w_9.js?version=42:57 (anonymous) @ 2VRzCA39w_9.js?version=42:57 b @ 2VRzCA39w_9.js?version=42:57 k @ 2VRzCA39w_9.js?version=42:57 l @ 2VRzCA39w_9.js?version=42:57 (anonymous) @ 2VRzCA39w_9.js?version=42:57 (anonymous) @ 2VRzCA39w_9.js?version=42:57 require @ 2VRzCA39w_9.js?version=42:36 (anonymous) @ 2VRzCA39w_9.js?version=42:57

Hello. I'm trying to enable social login buttons for Google and Facebook. I have registered my app and have my authentication keys in appsettings.json and set "IsEnabled": "true". But GetExternalAuthenticationProviders() in TokenAuthController returns 0.

I can see that ConfigureExternalAuthProviders() in GlobalOpinionsWebHostModule class is adding my providers to the list when the solution starts up.

So why can _externalAuthConfiguration.Providers in this code return 0?

[HttpGet] public List<ExternalLoginProviderInfoModel> GetExternalAuthenticationProviders() { return ObjectMapper.Map<List<ExternalLoginProviderInfoModel>>(_externalAuthConfiguration.Providers); }

Is there something I've forgotten? I'm using the Angular version.

Hello.

I want the user to be able to delete his/her account, but I'm not sure how I should do this. I'm trying to add a public method to the AccountController that is similar to the logout method. But the class does'nt implement a appservice interface, so the method is not visible in the api. How can I make this method visible? Do I need to sign out the user before I delete the record from db? Or how is the best way to do this?

Is there anyone here who knows why I get this error message?

at Abp.Modules.AbpModuleManager.<>c.<StartModules>b__15_2(AbpModuleInfo module) at System.Collections.Generic.List1.ForEach(Action1 action) at Abp.Modules.AbpModuleManager.StartModules() at Abp.AbpBootstrapper.Initialize() at Abp.AspNetCore.AbpApplicationBuilderExtensions.InitializeAbp(IApplicationBuilder app) at Abp.AspNetCore.AbpApplicationBuilderExtensions.UseAbp(IApplicationBuilder app, Action`1 optionsAction) at MySolution.Web.Startup.Startup.Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) in D:\MySolution\aspnet-core\src\MySolution.Web.Host\Startup\Startup.cs:line 120 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at Microsoft.AspNetCore.Hosting.ConventionBasedStartup.Configure(IApplicationBuilder app) at Microsoft.AspNetCore.Server.IISIntegration.IISSetupFilter.<>c__DisplayClass3_0.

Showing 1 to 10 of 20 entries