इस सवाल आप से क्या मतलब है पर निर्भर करेगा बहुत ज्यादा का जवाब ASP.NET में कुछ जानकारी को फिर से लोड एमवीसी परियोजना। यह स्पष्ट रूप से निर्दिष्ट समस्या नहीं है और इस तरह, स्पष्ट रूप से अधिक से अधिक, इसका स्पष्ट रूप से उत्तर नहीं दिया जा सकता है।
तो हम यह मान करता है, तो यह है कि इस से आप समय-समय पर कुछ नियंत्रक कार्रवाई पोल और आप setInterval जावास्क्रिप्ट समारोह इस्तेमाल कर सकते हैं समय-समय पर एक AJAX अनुरोध भेजकर सर्वर पोल और यूआई अद्यतन करने के लिए एक दृश्य के बारे में जानकारी अद्यतन करना चाहते:
window.setInterval(function() {
// Send an AJAX request every 5s to poll for changes and update the UI
// example with jquery:
$.get('/foo', function(result) {
// TODO: use the results returned from your controller action
// to update the UI
});
}, 5000);
दूसरी ओर आप नियमित रूप से समय में सर्वर पर कुछ कार्य को क्रियान्वित करने का अर्थ यह तो आप RegisterWaitForSingleObject विधि इस तरह इस्तेमाल कर सकते हैं:
var waitHandle = new AutoResetEvent(false);
ThreadPool.RegisterWaitForSingleObject(
waitHandle,
// Method to execute
(state, timeout) =>
{
// TODO: implement the functionality you want to be executed
// on every 5 seconds here
// Important Remark: This method runs on a worker thread drawn
// from the thread pool which is also used to service requests
// so make sure that this method returns as fast as possible or
// you will be jeopardizing worker threads which could be catastrophic
// in a web application. Make sure you don't sleep here and if you were
// to perform some I/O intensive operation make sure you use asynchronous
// API and IO completion ports for increased scalability
},
// optional state object to pass to the method
null,
// Execute the method after 5 seconds
TimeSpan.FromSeconds(5),
// Set this to false to execute it repeatedly every 5 seconds
false
);
आप कुछ और ही मतलब, hesi नहीं है अपने प्रश्न के लिए अधिक जानकारी प्रदान करने के लिए टेट।
स्रोत
2010-12-01 22:43:00
हमें – rboarman
पर क्या करने की कोशिश कर रहे हैं, इसके बारे में अधिक जानकारी चाहिए क्या आप कई तरीकों को सूचीबद्ध कर सकते हैं ताकि हम अपनी राय दे सकें? –
क्यों एक अलग आवेदन नहीं है? –