Error 500 with ASP.NET Core (POST, PUT and DELETE) - asp.net-core

Good day all,
I have just implemented a REST API in ASP.NET MVC Core. GET works just fine but when I try to test POST, PUT and DELETE I am getting the same error:
{System.Security.Authentication.AuthenticationException: The remote certificate is invalid according to the validation procedure.}
Could anyone help me with hints how to avoid this error?

Well... I found out that I need to install SSL certificate - can be made using MakeCert.exe.

Related

ASP.NET Core FindByEmailAsync is not responding and getting error 500

Using ASP.NET Core with the Identity framework.
I have a project running on Azure, with a SQL Server database, a web site and an API.
Suddenly, today when trying to login to the system (from the app that calls the API), it is stuck for around 15 seconds and then I get an error http 500.
I try to run the API function that authenticate the user from the local env. and was able to reproduce the bug.
The first line of the function is :
var user = await _userManager.FindByEmailAsync(model.Username);
This is the line the program is stuck till getting error message 500.
I don't even know how to approach this, I try to add a line that retrieves one of the user details, just to make sure the API can still talk to the database and it works fine.
How can check what is wrong with it? If I had the implementation of this function, maybe I can debug it.
Any suggestions?

'https://restcountries.eu/rest/v2/all' not working, How to get all countries now?

Before week ago, https://restcountries.eu/rest/v2/all was giving country code but now it is not working so how can someone use it to get all country code.
Code throws The SSL connection could not be established, see inner exception. The remote certificate is invalid according to the validation procedure from where the rest call made of 'https://restcountries.eu/rest/v2/all' this API.
Any alternate API to get all country code, name and flag. as we are using it at ASP.Net side, front-end side(Angular) Andriod, and iOS App. It would be better to have API.
The same issue on their git repo.
This is now available in v2 version and v3 version on restcountries.com.
Response takes some time and it has a lot of information.

Server side Blazor blazor.server.js instead of blazor.webassembly.js

I am trying out Server-side Blazor (.net core 3.0 Preview 5).
I have been searching the web but can't seem to find an answer.
I really like the "layout" of the Blazor (ASP.NET Core hosted) template (see image below). The client part of that is WebAssebly. But I read someware that I could change blazor.webassembly.js to blazor.server.js and that it would be it. How ever that doesn't work. I get some errors in the console log:
Error: Failed to complete negotiation with the server: Error: Internal Server Error blazor.server.js:1
Error: Cannot send data if the connection is not in the 'Connected' State. blazor.server.js:1
What do I need to do for the client to use blazor.server.js instead of blazor.webassembly.js?
Or have I just misunderstood everything?
You are not consistent in describing what flavor of Blazor you're using. I'm going to provide you the code below of how to implement Blazor dual mode, but not without warning that though shifting from Blazor client side to Blazor server side, in configuration term is made simple by a developer named Suchiman, coding for the client can be very different than coding for the server, and you should know what you're doing and take into account many factors...
Here's the link that instruct you how to move to and forth:
https://github.com/Suchiman/BlazorDualMode
Please don't hesitate to ask any question about the above.
Next time select the blazor tag. I've got to this section by mere chance. The Blazor section is very active...

TypeError: Failed to fetch swagger ui issue

I am new with swagger and i am experiencing some problem with it.I've run a server for the swagger and additional for the dummy data that you can generate from the swagger but both are not connected somehow.
I am getting this error
also this is the error i am getting when i do so:
I know this issue is with CORS and i've read all docs provided:
cors git
Crossover with git -cors
a link from SO with similar issue: link
and i am still not able to fix my issue!
Please advise,
Darko
Ok,
I found a solution to my problem. What basically what was i doing was testing the problem on a wrong server the swagger local editor and i needed to test it on the swagger tester. Sorry for the inconvenience i solved my problem by just testing it on the local swagger ui that is provided by the swagger server.

Asp.net Core iis Error 401.2 - Unauthorized

I have followed this article to create a web.api site on my IIS. But I am getting Error 401.2 - Unauthorized. The site has anonymous access enabled, so I not sure where else should I look. Running dotnet command from the command prompt using my dll as a parameter works fine.
After messing around with the configuration I was able to get it to work.
I had to put an specifc user in the anonymous access.