Click here to Skip to main content
15,665,276 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have created a couple of C# .NET 5 websites and deployed them via Kestrel to my Raspberry Pi. I am using Docker and the setup I have is: Website1 - uses port 5000 and port 5001 (https) Website2 - uses port 5002 and port 5003 (https)

I configured port forwarding on my router with a range from 5000 to 5050. This must be setup correctly since Website1 is accessible from outside my network just fine and external IP works fine.

I can access Website2 from any machine on my local network (using raspberrypi:5002) but if I try to access from a device not connected to my network (using external IP address and port 5002) then it fails to load. I noticed this error on the Pi:

Microsoft.AspNetCore.Antiforgery.DefaultAntiforgery[7] 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 {b0a63215-b1e3-42f7-8d5b-921be6ed3d1a} was not found in the key ring.

It seems strange this error appears but I probably don't understand it to be honest as I normally just write code. Can anybody please advise what the problem might be?

What I have tried:

I have googled lots and tried many things.
Updated 16-Feb-22 22:27pm
Gerry Schmitz 15-Feb-22 12:47pm    
Maybe your code isn't fully re-entrant, and you're trying to "share" a token.

Ok, I have discovered that the website loads fine if I turn off the Wifi on my phone. My network seems to be 'blocking' the website somehow.
Share this answer
I have got round the error by preventing HTTPS but unfortunately the page still doesn't load.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900