Base solution for your next web application

Activities of "vnetonline"

If you are getting the following error in your console in developer tools after logging in

Response to preflight request doesn't pass access control check: The value of the 'Access-Control-Allow-Credentials' header in the response is '' which must be 'true' when the request's credentials mode is 'include'. The credentials mode of requests initiated by the XMLHttpRequest is controlled by the withCredentials attribute.

Error: Failed to complete negotiation with the server: Error

Error: Failed to start the connection: Error

POST https://yourserver.azurewebsites.net/signalr-chat/negotiate?encauthtoken=wNYmO41... net::ERRFAILED

Solution:

Turn on Enable Access-Control-Allow-Credentials Turn WebSockets to on.

Explanation:

From the Azure Portal locate your App Service that is hosting your AspNetCore website

  1. Click CORS

  1. Check the Enable Access-Control-Allow-Credentials

  1. Click Save

  2. Now click on Configruation under the Stettings Sections in the menu

  1. Click on General Settings and turn on Websockets

  1. Now you should the chat should connect once logged in and no more errors in your console in developer tools.

Be sure to empty Cache and Hard reload your browser

If you are getting the following error

Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.

Solution:

Enable Cross-Origin Resource Sharing (CORS) on your Azure App Service Web App.

Explanation:

  1. From the Azure Portal locate your App Service that is hosting your AspNetCore website
  2. Click CORS

  1. Enter the full URL of the site you want to allow to access your AspnetCore or * to allow all domains
  2. Click Save
  3. Now you should be able to access your AspNetCore apis from your Angular app.

Be sure to empty Cache and Hard reload your browser

good pick up maliming thanks you are a ledgend

All good works, here is the result

I will be making a video turorial on this process which will be avalible at www.amazingsolutions.com.au shall come back and update this post when it is ready.

yes i belive i have it right

"App": { "ServerRootAddress": "https://amazingsolutions.azurewebsites.net", "ClientRootAddress": "https://amazingsolutions-client.azurewebsites.net", "CorsOrigins": "http://*.amazingsolutions.com.au,https://amazingsolutions-client.azurewebsites.net,https://amazingsolutions.azurewebsites.net" }

This config is in my appsettings.Production.json

I have built and deployed the Host project to Azure using the Release configuration.

okay that command worked I increased the memory size to 16384 for good measure now I can deploy to azure

Just incase anyone is wondering I am remoting into my azure VM and checked if the build worked. I will be creating a course very soon how to setup development environment for aspnetzero and on my website amazingsolutions.com.au

now i am getting

C:\Users\vbelani\Amazing\AmazingSoftware\angular>ng build --prod Your global Angular CLI version (7.3.9) is greater than your local version (7.3.7). The local Angular CLI version is used.

To disable this warning use "ng config -g cli.warnings.versionMismatch false". 92% chunk asset optimization TerserPlugin <--- Last few GCs --->

[8664:000001E5342779F0] 213055 ms: Scavenge 1320.3 (1437.9) -> 1310.8 (1439.4) MB, 44.2 / 0.0 ms (average mu = 0.272, current mu = 0.294) allocation failure [8664:000001E5342779F0] 213205 ms: Scavenge 1324.1 (1439.4) -> 1314.6 (1442.4) MB, 20.1 / 0.0 ms (average mu = 0.272, current mu = 0.294) allocation failure

<--- JS stacktrace --->

==== JS stack trace =========================================

0: ExitFrame [pc: 000002A315F5C5C1]

Security context: 0x031a8499e6e9 <JSObject> 1: _walk [00000389F951FA81] [C:\Users\vbelani\Amazing\AmazingSoftware\angular\node_modules\terser\dist\bundle.min.js:~1] [pc=000002A31903C529](this=0x022660b76dd1 <AST_SymbolRef map = 000003FCCF043181>,e=0x02ef5854c9c9 <gn map = 000003F62F605221>) 2: /* anonymous */ [000002C0C3566429] [C:\Users\vbelani\Amazing\AmazingSoftware\angular\node_modules\t...

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory 1: 00007FF6F443F04A v8::internal::GCIdleTimeHandler::GCIdleTimeHandler+5114 2: 00007FF6F441A0C6 node::MakeCallback+4518 3: 00007FF6F441AA30 node_module_register+2032 4: 00007FF6F46A20EE v8::internal::FatalProcessOutOfMemory+846 5: 00007FF6F46A201F v8::internal::FatalProcessOutOfMemory+639 6: 00007FF6F4BC2BC4 v8::internal::Heap::MaxHeapGrowingFactor+9556 7: 00007FF6F4BB9C46 v8::internal::ScavengeJob::operator=+24310 8: 00007FF6F4BB829C v8::internal::ScavengeJob::operator=+17740 9: 00007FF6F4BC0F87 v8::internal::Heap::MaxHeapGrowingFactor+2327 10: 00007FF6F4BC1006 v8::internal::Heap::MaxHeapGrowingFactor+2454 11: 00007FF6F477CDB7 v8::internal::Factory::NewFillerObject+55 12: 00007FF6F4812CC6 v8::internal::WasmJs::Install+29414 13: 000002A315F5C5C1

C:\Users\vbelani\Amazing\AmazingSoftware\angular>

i have already added ng-high-memory in package.json

"scripts": { "ng-high-memory": "node --max_old_space_size=8192 ./node_modules/@angular/cli/bin/ng", "ng": "ng", "publish": "ng build --prod", "start": "ng serve --host 0.0.0.0 --port 4200", "hmr": "ng serve --host 0.0.0.0 --port 4200 --hmr", "test": "ng test", "pree2e": "webdriver-manager update --standalone false --gecko false", "e2e": "protractor" },

just deleted the node_modules folder and ran yarn again got the following warinings

C:\Users\vbelani\Amazing\AmazingSoftware\angular>yarn yarn install v1.15.2 [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 " > @angular/[email protected]" has incorrect peer dependency "zone.js@~0.8.26". 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 " > @swimlane/[email protected]" has incorrect peer dependency "zone.js@^0.8.26". warning " > [email protected]" has incorrect peer dependency "@angular/[email protected]". warning " > [email protected]" has incorrect peer dependency "@angular/[email protected]".

could this be the issue how do i resolve these warnings

How do you execute these batch files when you hit the play button and how do you go about debugging the project ?

It appears that this happens when the foreign key is a string and is required. For eg

[Required] public virtual string BranchId { get; set; }

If the foreign keys are longs, ints etc, they can be non nullable. But in case of strings, this causes a problem. It would be nice if someone could investigate whether this is a boilerplate issue or an entity framework one.

For the time being I simply do this to make it all work.. (let me know if this is wrong approach). It tends to update the LastModificationTime, DeletionTime and DeleterUserId correctly.

    public async Task Delete(EntityDto&lt;string&gt; input)
    {
        var lead = await _leadRepository.GetAsync(input.Id);
        if(lead != null)
        {
            lead.IsDeleted = true;
        }
    }

Yes tried that already but same error. It's happening for another table as well. Is there some way to debug this? Could it be that some packages are out of date and if so how should these packages be updated using nuget? Thanks.

Showing 1 to 10 of 33 entries