3
Answers

How to use JWT in a MVC application(.NET 6)?

Can anyone share a full fledged project or resource where JWT is being used. I know how to generate JWT token and test in swagger or postman.But I don't how to implement JWT in my MVC project. II want to add JWT authentication and authorization in my MVC application. What can I do?

Please tell me how to implement JWT in a MVC project.

Answers (3)
1
chrishornberger

chrishornberger

NA 277 0 21y
Wow. I wouldn't have thought that. I was sure a switch was flaky. Hey, either way a fix is a fix, right :)
1
roy_v

roy_v

NA 13 0 21y
It was a firewall issue! Thanks chornberger for pointing me in the right direction. Glad to get this one solved. Thanks again, Roy
1
chrishornberger

chrishornberger

NA 277 0 21y
wow. get your network staff to sniff and track some packets. Sounds like you got a switch/router with a flaky blade. If it was the network card even, the power down would have cycled that. It's further up the chain. It's not a hub... hubs are dumb. It's either a switch or a router. I'm guessing a switch.
1
roy_v

roy_v

NA 13 0 21y
Yes I have tried it without the GC part. Tried a power down, but that did not work. But I have found something interesting! I was taking your suggestion about trying another box. So I started up my Windows service on my machine, had the client access the object, and then tried to shut down the Windows service and then restart it, same error. I then take the app and install the Windows service on another developer's machine, which has never had this application before, and when I installed it and tried to start it, I get the error! This tells me there is something going on at the network level. Am I on the right track, and if so, any suggestions on what I should be looking for?
1
chrishornberger

chrishornberger

NA 277 0 21y
Just for giggles, have you tried it without explicitly invoking GC?
1
roy_v

roy_v

NA 13 0 21y
Here is my code: protected override void OnStart(string[] args) { //Create the remote TCP object tscPublish=new TcpServerChannel(System.String.Empty,2300); ChannelServices.RegisterChannel(tscPublish); RemotingConfiguration.RegisterWellKnownServiceType(typeof(EI),"Publisher",WellKnownObjectMode.SingleCall); } protected override void OnStop() { //Begin garbage collection process tscPublish.StopListening(listener); ChannelServices.UnregisterChannel(tscPublish); GC.Collect(GC.GetGeneration(tscPublish)); tscPublish=null; } The listener variable is just an object variable with the port number assigned to it (2300), and it is simply there to satisfy the requirements of the StopListening property.
1
chrishornberger

chrishornberger

NA 277 0 21y
Reboots (without power down) don't really do anything to the hardware. All they really do is reload drivers. If you've got an issue on your LAN card... or just a really cheap lan card... or heck, maybe even a really *GOOD* lan card that does some intelligent stuff with what the software asks of it, maybe that's what's going on too. I'd guess it's a card issue just being flaky, tho'. I've heard of switches doing crazy things with ports and stuff, but I'd stick local to the box for diagnostics. What if you moved it to another box... does the issue remain?
1
chrishornberger

chrishornberger

NA 277 0 21y
PS... Reboot doesn't clear this but I bet a power-off clean boot will. I'm guessing you *might* have a lan-card or HAL issue.
1
chrishornberger

chrishornberger

NA 277 0 21y
can we see your tear-down code? I'm doing something similar in a project (Win2k Server, sp3?) and not having this problem.
1
roy_v

roy_v

NA 13 0 21y
Yes I am explicitly, with a clean exit, unregistering the channel. So there are no errors or anything, I am simply stopping the Windows serivce. I think my next step is to give Microsoft a call. Anyone else have suggestions?
1
chrishornberger

chrishornberger

NA 277 0 21y
Are you explicitly unregistering the channel or is something happening to cause an unclean exit? I know there was a problem a few years ago on Win9x boxes where the OS wasn't releasing sockets and the intrinsic timeout (I think it was 5? minutes) had to be used. But they fixed it with a service pack or something.
1
roy_v

roy_v

NA 13 0 21y
Forgot to mention that I have tried this on Windows 2000 SP3 and SP4 and Windows XP Professional SP1. I am using .NET v1.1