मैं यह सुनिश्चित करना चाहता हूं कि मेरी वेबसाइट भविष्य में क्लाउड पर होस्ट करने में सक्षम है और यह भी कि कई अनुरोधों को संभाल सकता है।एएसपी.नेट एमवीसी स्थैतिक चर कितने सुरक्षित हैं
स्थैतिक चर कितने सुरक्षित हैं?
क्या वे असुरक्षित हैं क्योंकि अलग-अलग उपयोगकर्ताओं द्वारा अलग-अलग अनुरोध वास्तव में इन स्थिर चर साझा कर रहे हैं? या ऐसा इसलिए है क्योंकि यदि आप साइट को थ्रेड/शेर्डिंग या इसी तरह से फैलाते हैं, (उच्च लोड को संभालने के लिए) धागे स्थिर चर साझा कर रहे हैं?
मुख्य रूप से मेरे पास स्थिर गुणों के साथ सहायक वर्ग हैं, क्या मुझे इस आर्किटेक्चर को बदलना चाहिए ताकि मैं प्रत्येक वर्ग का उदाहरण बना सकूं और उदाहरणों तक पहुंच सकूं?
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 = "[email protected]" + EmailHostName.ToLower();
SupportEmailAddress = "[email protected]" + EmailHostName.ToLower();
ErrorEmailAddress = "[email protected]" + 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()
{
}
}
}
समान नियम लागू होते हैं ... स्थैतिक ऐप डोमेन के भीतर साझा किया जाता है। साझा कॉन्फ़िगरेशन डेटा (जैसा कि आपके उदाहरण में है) के लिए, यह वही हो सकता है जो आप चाहते हैं, लेकिन केवल एक बार, और एक थ्रेड से प्रारंभ करने के लिए सावधानी बरतें। –