Base solution for your next web application

Activities of "yoshrepublic"

Thank you

Thank you. I have added the below class to the web.core layer and the interface to the core layer. It works like a charm. My only question is should I be using ISingletonDependency instead?

` class AppContextAccessor: IAppContextAccessor, ITransientDependency { private readonly IHttpContextAccessor _httpContextAccessor;

    public AppContextAccessor(IHttpContextAccessor contextAccessor)
    {
        _httpContextAccessor = contextAccessor;
    }

    public string GetIpAddress()
    {
        var httpContext = _httpContextAccessor.HttpContext;
        return httpContext.Connection.RemoteIpAddress.ToString();
    }

    public string GetBrowserInfo()
    {
        var httpContext = _httpContextAccessor.HttpContext;
        return httpContext.Request.Headers["User-Agent"].ToString();
    }
}`

I allow a few types of unauthenticated requests to some methods in an appservice on the application layer. I would like capture the requesting IP address. Is there any way to do that? Do I have access to the context?

Below is what's at the end of the logfile. I have tried in incognito window or different browser with no luck.

INFO 2019-06-18 12:12:29,182 [5 ] soft.AspNetCore.Hosting.Internal.WebHost - Request starting HTTP/1.1 DEBUG http://localhost:22742/ 0 INFO 2019-06-18 12:12:29,182 [4 ] soft.AspNetCore.Hosting.Internal.WebHost - Request starting HTTP/1.1 GET http://localhost:22742/
INFO 2019-06-18 12:12:29,259 [5 ] soft.AspNetCore.Hosting.Internal.WebHost - Request finished in 80.3749ms 200 INFO 2019-06-18 12:12:29,304 [4 ] tion.Cookies.CookieAuthenticationHandler - Identity.Application was not authenticated. Failure message: Unprotect ticket failed INFO 2019-06-18 12:12:29,668 [8 ] soft.AspNetCore.Hosting.Internal.WebHost - Request finished in 491.5018ms 404 INFO 2019-06-18 12:14:32,889 [19 ] soft.AspNetCore.Hosting.Internal.WebHost - Request starting HTTP/1.1 GET http://localhost:22742/
INFO 2019-06-18 12:14:32,895 [19 ] soft.AspNetCore.Hosting.Internal.WebHost - Request finished in 6.3843ms 404

I have your latest (7.0) single solution and I get a page not found error when I start the project: No webpage was found for the web address: http://localhost:22742/.

I have restored the database and everything seems to work fine when I use separate solutions. The startup project is set to Web.Host and I get no build errors. Did I miss a step somewhere? I found this https://support.aspnetzero.com/QA/Questions/6432 but it doesn't help. The only thing I have modified is MultitenancyEnabled. Any suggestions?

Thank you

Wow. These have got to be the worst non-answers I have ever gotten back from a support team.

Do it as you do for your other websites? Seriously?

If you don't know what a DNS record or the world's largest domain registry is, you probably shouldn't be answering technical questions.

I have done my homework and tried to find documentation on publishing and implement your public site but only found scattered bits and pieces. I did not ask you to fix code that I wrote or broke. I have asked instructions on how to use your product in the most common scenario I can think of.

So here it is again:

I have a typical setup on Azure with three app services:

mydomainAPI.azurewebsites.net (.Net core 6.5) mydomainUi.azurewebsites.net (Angular 6.5) mydomainPublic.azurewebsites.net (MVC Public ASPNETZERO site)

The public site is only used for the home page. All other pages will be handled by Angular

  1. What steps do I need to make to publish and implement the PUBLIC site in Azure (similar to your Angular documentation)?
  2. The steps should include all application settings changes in the public project showing the app service domains as well as settings that need to be changed in the other two projects if needed.
  3. What DNS records are required to make this all work with the browser only showing mydomain.com?

Hello,

Thank you for your response. I understand that I could create a separate Angular solution for the public pages but what I really need fast loading home page withot all the Angular overhead. My questions were more about implementing your public solution in a fairly typical scenaro that I have and most likely others too. Can you lay out how I would go about implementing your public site and answer my bolded questions please?

Hello,

I am trying to wrap my head around what would be involved adding a fast loading home page using your public site to an existing Azure setup. Currently I have two app services on Azure:

mydomainAPI.azurewebsites.net (.Net core 6.5) mydomainUi.azurewebsites.net (Angular 6.5)

I have a text domain pointer on godaddy for mydomain.com pointing @ to mydomainUi.azurewebsites.net

I have a public module in Angular that has a few components to handle public pages and has redirects in place to go to app/main when authentication is required. Everything works fine except the huge overhead of loading Agular on the home page (8+ seconds) . It is pretty bad locally too so it is not an Azure issue. Your public site loads very fast (.8s). I have published it to

mydomainPublic.azurewebsites.net

What do I need to do to have the public site handle the home page only and all other requests go to Angular? The urls in the browser still should just show mydomain.com and not the Azure app service domains.

What dns records do I need on godaddy?

I am assuming the appsettings.production.json for public site will look something like this:

"App": { "WebSiteRootAddress": "https://mydomain.com/", "AdminWebSiteRootAddress": "https://mydomainUI.azurewebsites.net" }

How will the appsettings.production.json look like for the Core and Angular project including CorsOrigins?

"App": { "WebSiteRootAddress": "", "ClientRootAddress": "", "CorsOrigins": "" },

Are there any additional steps required?

Thank you for your help

My azure pipeline fails at the ng build --prod step. This does not happen locally. I am on version 6.5. I have the same version of yarn locally.

Output of step:

##[section]Starting: Command Line Script
==============================================================================
Task         : Command Line
Description  : Run a command line script using cmd.exe on Windows and bash on macOS and Linux.
Version      : 2.148.0
Author       : Microsoft Corporation
Help         : [More Information](https://go.microsoft.com/fwlink/?LinkID=613735)
==============================================================================
Generating script.
Script contents:
d:\a\1\s\node_modules\.bin\ng.cmd build --prod
========================== Starting Command Output ===========================
##[command]"C:\windows\system32\cmd.exe" /D /E:ON /V:OFF /S /C "CALL "d:\a\_temp\25f9c426-3bbc-41dd-92ee-0fc57fb89c88.cmd""
Browserslist: caniuse-lite is outdated. Please run next command `yarn upgrade caniuse-lite browserslist`
FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
 1: 00007FF7A9AEF04A v8::internal::GCIdleTimeHandler::GCIdleTimeHandler+5114
 2: 00007FF7A9ACA0C6 node::MakeCallback+4518
 3: 00007FF7A9ACAA30 node_module_register+2032
 4: 00007FF7A9D520EE v8::internal::FatalProcessOutOfMemory+846
 5: 00007FF7A9D5201F v8::internal::FatalProcessOutOfMemory+639
 6: 00007FF7AA272BC4 v8::internal::Heap::MaxHeapGrowingFactor+9556
 7: 00007FF7AA269C46 v8::internal::ScavengeJob::operator=+24310
 8: 00007FF7AA26829C v8::internal::ScavengeJob::operator=+17740
 9: 00007FF7AA267765 v8::internal::ScavengeJob::operator=+14869
10: 00007FF7AA271064 v8::internal::Heap::MaxHeapGrowingFactor+2548
11: 00007FF7A9E321C0 v8::internal::Factory::NewByteArray+112
12: 00007FF7AA4968AC v8::internal::compiler::MachineOperatorReducer::ReduceFloat64RoundDown+7564
13: 00007FF7AA18C920 v8::internal::compiler::Pipeline::AllocateRegistersForTesting+4608
14: 00007FF7AA184CCB v8::internal::compiler::ValueNumberingReducer::operator=+10123
15: 00007FF7AA252ACA v8::internal::Zone::NewExpand+1978
16: 00007FF7AA2550E4 v8::internal::Zone::NewExpand+11732
17: 00007FF7AA2BD589 v8::internal::OptimizingCompileDispatcher::InstallOptimizedFunctions+393
18: 00007FF7AA099633 v8::internal::StackGuard::HandleInterrupts+531
19: 00007FF7A9EC26E7 v8::internal::WasmJs::Install+27911
20: 00000348008DC5C1 
##[error]Cmd.exe exited with code '134'.
##[section]Finishing: Command Line Script

YML script:

pool:
  name: Hosted VS2017
  demands: npm

steps:
- task: geeklearningio.gl-vsts-tasks-yarn.yarn-installer-task.YarnInstaller@2
  displayName: 'Use Yarn 1.x'
  inputs:
    checkLatest: true

- task: geeklearningio.gl-vsts-tasks-yarn.yarn-task.Yarn@2
  displayName: 'Yarn install'
  inputs:
    Arguments: install

- task: geeklearningio.gl-vsts-tasks-yarn.yarn-task.Yarn@2
  displayName: 'Yarn: yarn upgrade caniuse-lite browserslist'
  inputs:
    Arguments: 'upgrade caniuse-lite browserslist'

- task: Npm@0
  displayName: 'npm install'
  inputs:
    arguments: '-g @angular/cli'

- script: '$(Build.SourcesDirectory)\node_modules\.bin\ng.cmd build --prod'
  displayName: 'Command Line Script'

- task: CopyFiles@2
  displayName: 'Copy Files to: $(System.DefaultWorkingDirectory)/dist/assets'
  inputs:
    Contents: appconfig.json
    TargetFolder: '$(System.DefaultWorkingDirectory)/dist/assets'

- task: Npm@1
  displayName: 'npm custom'
  inputs:
    command: custom
    verbose: false
    customCommand: 'build-prod'

Output yarn:

##[section]Starting: Yarn install
==============================================================================
Task         : Yarn task
Description  : Executes Yarn
Version      : 2.8.1001
Author       : Geek Learning
Help         : [More Information](https://github.com/geeklearningio/gl-vsts-tasks-yarn/wiki/Yarn) (Version 2.8.1001).

Dear Angular and Ember CLI users, please check our [known issues](https://github.com/geeklearningio/gl-vsts-tasks-yarn/wiki/Known-Issues)
==============================================================================
SYSTEMVSSCONNECTION exists true
SYSTEMVSSCONNECTION exists true
[command]C:\windows\system32\cmd.exe /D /S /C "C:\hostedtoolcache\windows\yarn\1.16.0\x64\yarn-v1.16.0\bin\yarn.cmd install"
yarn install v1.16.0
[1/4] Resolving packages...
[2/4] Fetching packages...
info [email protected]: The platform "win32" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
warning " > @swimlane/[email protected]" has unmet peer dependency "d3@^4.10.2".
warning " > @swimlane/[email protected]" has unmet peer dependency "d3-array@^1.2.1".
warning " > @swimlane/[email protected]" has unmet peer dependency "d3-brush@^1.0.4".
warning " > @swimlane/[email protected]" has unmet peer dependency "d3-color@^1.0.3".
warning " > @swimlane/[email protected]" has unmet peer dependency "d3-force@^1.1.0".
warning " > @swimlane/[email protected]" has unmet peer dependency "d3-format@^1.2.0".
warning " > @swimlane/[email protected]" has unmet peer dependency "d3-hierarchy@^1.1.5".
warning " > @swimlane/[email protected]" has unmet peer dependency "d3-interpolate@^1.1.5".
warning " > @swimlane/[email protected]" has unmet peer dependency "d3-scale@^1.0.6".
warning " > @swimlane/[email protected]" has unmet peer dependency "d3-selection@^1.1.0".
warning " > @swimlane/[email protected]" has unmet peer dependency "d3-shape@^1.2.0".
warning " > @swimlane/[email protected]" has unmet peer dependency "d3-time-format@^2.1.0".
warning " > [email protected]" has incorrect peer dependency "@angular/core@^7.1.4".
warning " > [email protected]" has incorrect peer dependency "@angular/common@^7.1.4".
[4/4] Building fresh packages...
Done in 131.50s.
##[section]Finishing: Yarn install

Showing 1 to 10 of 14 entries