ASP.NET MVC Wie sicher sind statische Variablen?

Ich möchte sicherstellen, dass meine Website in Zukunft in der Cloud gehostet werden kann und dass sie auch viele Anfragen bearbeiten kann.

Wie sicher sind statische Variablen?

Sind sie unsicher, weil separate Anforderungen von separaten Benutzern diese statischen Variablen tatsächlich gemeinsam nutzen? Oder liegt es daran, dass die Threads die statischen Variablen gemeinsam nutzen, wenn Sie die Site über Threads / Shards oder ähnliches verteilen (um hohe Lasten zu bewältigen)?

Hauptsächlich habe ich Hilfsklassen mit statischen Eigenschaften. Sollte ich diese Architektur ändern, damit ich stattdessen eine Instanz jeder Klasse erstelle und auf die Instanzen zugreife?

Hier ist ein Beispiel von dem, was ich tue:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Mvc.Mailer;

namespace MVCWebsite.Helpers
{
        public class AppSettings
        {
                public static void OnAppInit()
                {
                        //General
                        AppName = "MyApp";
                        DesktopBaseURLs = new Dictionary<string, string>();
                        DesktopBaseURLs.Add("dev", "localhost:50560");
                        DesktopBaseURLs.Add("test", "www.test.whatever.com");
                        DesktopBaseURLs.Add("live", "www.whatever.com");
                        MobileBaseURLs = new Dictionary<string, string>();
                        MobileBaseURLs.Add("dev", "m.local.whatever.com");
                        MobileBaseURLs.Add("test", "m.test.whatever.com");
                        MobileBaseURLs.Add("live", "m.whatever.com");

                        //Emails
                        EmailHostName = AppName + ".com"; //For the moment atleast
                        NoReplyEmailAddress = "no-reply@" + EmailHostName.ToLower();
                        SupportEmailAddress = "support@" + EmailHostName.ToLower();
                        ErrorEmailAddress = "errors@" + EmailHostName.ToLower();

                        //Resources
                        TempFileURL = "/content/temp/";
                        UserDataURL = "/content/user-content/";
                        ProfilePicturesURL = UserDataURL + "profile-pictures/";

                        var a = GlobalHelper.GetURLAsServerPath(ProfilePicturesURL);
                        var b = a;

                }

                //General
                public static string AppName { get; set; }
                public static Dictionary<string, string> DesktopBaseURLs;
                public static Dictionary<string, string> MobileBaseURLs;

                //Emails
                public static string EmailHostName { get; set; }
                public static string NoReplyEmailAddress { get; set; }
                public static string SupportEmailAddress { get; set; }
                public static string ErrorEmailAddress { get; set; }

                //Resources
                public static string UserDataURL { get; set; }
                public static string TempFileURL { get; set; }
                public static string ProfilePicturesURL { get; set; }

                //Methods
                public static void SetAppURL()
                {

                }
        }
}

Antworten auf die Frage(2)

Ihre Antwort auf die Frage