Redis Connection with Cache is failing - asp.net-core

Goal:
Enable to use Redis Cache in a asp.net core sample project from this webpage.
(https://dotnetcoretutorials.com/2017/01/06/using-redis-cache-net-core/)
Problem:
When I follow the instruction and use the source code I get a error message saying
"StackExchange.Redis.RedisConnectionException: 'It was not possible to connect to the redis server(s); to create a disconnected multiplexer, disable AbortOnConnectFail. SocketFailure on PING"
Q1.
What part of the website or the source code am I missing?
Q2.
Do you need an account at Redis in order use an unique IP number that should be applied at "option.Configuration = "127.0.0.1";"?
Info:
Using VS 2017 asp.net core mvc 2.2
Thank you!

Related

UMBRACO 10 HTTP Error 500.30 - ASP.NET Core app failed to start

I am trying to deploy my Website with umbraco 10, I always get the following error:
HTTP Error 500.30 - ASP.NET Core app failed to start
The website works correctly locally, however when deploying the app I get the same error...
Details:
DB SQL Server
Azure WebApp .Net6
What i have tried
I have followed the instructions: https://our.umbraco.com/documentation/Fundamentals/Setup/Server-Setup/azure-web-apps
I have created a project from scratch, thinking that the problem was some package, but still the same error.
This is how my umbraco 10 application looks once deployed from VS to an appservice (Azure)
The first thing I would do is check the logs on the the environment where you have deployed the code. That should give you a better idea what is actually going wrong as the error you are getting is very generic and not that helpful.
I have seen issues where the media folder is missing and that is something to check.
When I have issues in Azure, I also look at the files via the Azure Portal and check the connection string and any other configurations files to ensure they look correct. It could be the deployment has screwed up some values.
Have a look at this post which may provide some further details - https://our.umbraco.com/forum/using-umbraco-and-getting-started/108288-getting-http-error-50030-after-successful-publishing-to-azure

Can I use Serilog Enrichers to get Machine / Hostname Name?

I have been searching on how I can get client hostname/computer name using ASP.Net Core MVC using .net 3.1 .
There are threads here on SO but most of them are not working on intranet apps (clients used VPN to connect to network).
I've seen some suggestion on some thread to use Serilog Enrichment.
My question is how can I use this one? Can I really get the Machine Name (value passed on the application to db) using this plugin?
You should be able to. Try this configuration on:
"Using": [ "Serilog.Enrichers.ClientInfo" ],
"Enrich": [ "WithMachineName", "WithClientIp" ]
You'd need the nuget package Serilog.Enrichers.ClientInfo
UPDATE:
You can also write the logs directly to the database using one of the database sinks. For eg, to write to a MSSQL database, you could use the sink here: Serilog.Sinks.MSSqlServer
This gives you control over what properties and you want to log including Client Info

IIS shutsdown website even though timeout for app pool is set to 0

Title pretty much says it all. I have created a simple ASP.NET core 3.1 website which runs a MQTT subscriper. My problem is that after a while I see message in event viewer:
Application 'MACHINE/WEBROOT/APPHOST/MYWEBSITE' has shutdown.
Is there something I should add in the website itself or in IIS to make the website always running?
I found a complete step to step guide how to fix this from:
https://www.taithienbo.com/how-to-auto-start-and-keep-an-asp-net-core-web-application-and-keep-it-running-on-iis/
The missing part from my config was to add application initialization to server roles.
I had same problem before and solved with set Rapid-Fail protection to false.
If you trust to your server performance
or increase failure and maximum failures count.

Publish .NET Code application to Arvixe Host

I have a ASP.NET Core with Blazor website and I want to deploy it to Arvixe host. The website is very simple and contains only UI elements no database required. I published the website to a local file system and uploaded it using FTP to the Plesk.
When I am visiting the website, I receive this error:
500 - Internal server error. There is a problem with the resource you
are looking for, and it cannot be displayed.
I have tried to run it on the IIS and I received more details:
Configuration The configuration file cannot be read due to
insufficient permissions.
I tried to add IIS_IUSRS to the group and users for web.config but I am not able to find it because I am using a windows 10 connected to active directory.
Besides, I still don't know how to solve this problem at Arvixe. Does anyone know tips might help?
500 internal error is generic issue. Please kindly check the error message on the server and paste it here. Make sure that your provider has installed .net core bundled on their server and here are tutorial about publsih .net core using plesk https://windowswebhostingreview.com/how-to-publish-using-web-deploy-with-plesk-control-panel/. It should be working fine.
You need to give Full Trust permission (Read-Write-Execute) to your application folder and also to Application Pool and also check if the Runtime version supported by Arvixe matches with your Asp.net Core version.
Also enable the logs in web.config file by setting stdoutLogEnabled="true" to get detailed error so that you can investigate more about the error.

.net core ubuntu change port when using service

I'm trying to test running .net core on a different port when using the service.
However, I keep on getting an error with a status code 140.
This occurs in my two attempts :
1) adding --server.urls=http://0.0.0.0:555 in the service file
ExecStart=/usr/bin/dotnet /dotnetcore/published/TestingWebApi.dll
2) adding UseUrls("http://0.0.0.0:555") in the Program.cs
When I run it manually using the code
dotnet run --server.urls=http:0.0.0.0:555 it works.
Anybody has managed to get it using the service?
use the following
ExecStart=/usr/bin/dotnet /dotnetcore/published/TestingWebApi.dll --urls http://localhost:5002