Home > Net >  How to implement in c # to execute a method after specified time?
How to implement in c # to execute a method after specified time?

Time:11-04

Want to have a smoke the function of the random number to the specified time, now write good, the other is sent to execute, advice on how to achieve?
By the way, the site open, the Timer after close the web browser and the execution?

CodePudding user response:

Open the clock in the main program, test server time.

CodePudding user response:

Write a service performed regularly, in the background page refresh regularly

CodePudding user response:

reference 1/f, the wise know already should good karma response:
open the clock in the main program, test server time,

How to open a clock, consult, a freshman, I didn't learn this

CodePudding user response:

refer to the second floor it_gz_xi response:
write a service performed regularly, in the background page refresh regularly is good

How to write, consult, just a freshman, have not learned the

CodePudding user response:

Don't say "close the web browser", even open the web browser "daze", the web server did not receive any of your page request, not deal with things,

Asp.net webform may have a Timer controls, it over and over on the server side using asp.net ajax mechanism to rebuild the entire page, just use the HTML fragment refresh mechanism to the partial refresh the browser, which is suitable for gigabit broadband network inside in the office to write a few small OA,

Actual business project development, the server should be an independent service, such as Windows service, to server the independent roles, such as the so-called "extract data" work, and independent business server to push the data to a web server (for example, asp.net), the site by the websocket protocol are pushed to online web pages, or Windows service directly through the websocket push message to a web page (premise is web page first independence and server two-way connection) is established, this is the last six or seven years of HTML 5 technology,

CodePudding user response:

reference qq_40519336 reply: 3/f
Quote: reference 1/f, the wise know already should good karma response:
open the clock in the main program, test server time,

How to open a clock, consult, a freshman, I didn't learn this


So you learn technology but also a few years time, learn now foundation, first to learn javascript, use the front command commit statements (such as jQuery. Post) polling access web server, wake up the server to perform some operation, and the server performs results as statement returns, js again showcases, with the first entry level approach to simulate, said it's like a beginner thought they develop a WeChat server, he designed for hundreds of millions of people every second polling a server, that server and network will die, no use this first entry-level ideas (but it's totally wrong ideas) to learn the basic knowledge of the most basic,

CodePudding user response:

refer to 6th floor interacting in a professional developer response:
Quote: refer to the third floor qq_40519336 response:
Quote: reference 1/f, the wise know already should good karma response:
open the clock in the main program, test server time,

How to open a clock, consult, a freshman, I didn't learn this


So you learn technology but also a few years time, learn now foundation, first to learn javascript, use the front command commit statements (such as jQuery. Post) polling access web server, wake up the server to perform some operation, and the server performs results as statement returns, js again showcases, with the first entry level approach to simulate, said it's like a beginner thought they develop a WeChat server, he designed for hundreds of millions of people every second polling server at a time, think that the server and network do not die, with the first entry-level ideas (but it's totally wrong ideas) to the most basic learning some basic knowledge of

On the server processing mainly considering the safety problems, and an ajax request closed the web page is not dealt with yao... Want to achieve is to perform regularly, such as a method of execution server 5 o 'clock this afternoon, online to find the most are the realization of the Timer, after the struggle now is close the web browser will execute (has triggered a Timer)

CodePudding user response:

Is so many things, for beginners to learn things with design practice is completely against the commercialization of system, so make things tend to be a package to cope with the current task a few days, even training school teacher teach 90% are in the "pure fool to apply for" routines as the core, and you online can find need to redesign the system, but can only be understood "against the learning" to learn the most basic things, to help you take the youth to study unceasingly, the world is such,

refer to 7th floor qq_40519336 response:
online to find the most are the realization of the Timer, after the struggle now is close the web browser will execute (has triggered the Timer)

I've said, repeat, do you want to state what you said the Timer in the framework of the Timer? Why can play a role? I have already said above fourteen years ago asp.net ajax Timer control mechanism is what kind of, it with asp.net ajax and went to the framework, you use a frame design your web pages and system, to understand the principle,

Network system to know the score and rule, which is purely a Windows service server development, don't literally on the web server, web server as a carrier of the interface, and is not a real service,

CodePudding user response:

Your freshman year ans can not say what, also not with you mention selfhost, quartZ, window service, can only tell you IIS is not suitable for this

You must do, according to your situation, I suggest you use Windows own take plan task script to implement

Of course can be found online "c # Windows program task" material of

https://www.cnblogs.com/eliza209/p/11980512.html

CodePudding user response:

refer to the eighth floor interacting in a professional developer response:
is so many things, for beginners to learn things with design practice is completely against the commercialization of system, so make things tend to do a package a few days to deal with the current task, training school teacher teach even 90% is based on the "pure fool to apply for" routine as the core, and you online can find need to redesign the system, but can only be understood "against the learning" to learn the most basic things, to help you take the youth to study unceasingly, the world is such,

Quote: refer to 7th floor qq_40519336 response:
online to find the most are the realization of the Timer, after the struggle now is close the web browser will execute (has triggered the Timer)

I've said, repeat, do you want to state what you said the Timer in the framework of the Timer? Why can play a role? I have already said above fourteen years ago asp.net ajax Timer control mechanism is what kind of, it with asp.net ajax and went to the framework, you use a frame design your web pages and system, to understand the principle,

Network system to know the score and rule, which is purely a Windows service server development, don't literally on the web server, web server as a carrier of the interface, and is not a real service,


Understand, trouble you, thank you for your advice!

CodePudding user response:

references 9 f wanghui0380 response:
your freshman year ans can not say what, also not with you mention selfhost, quartZ, window service, can only tell you IIS isn't suitable for to do the things

You must do, according to your situation, I suggest you use Windows own take plan task script to implement

Of course can be found online "c # Windows program task" material of

https://www.cnblogs.com/eliza209/p/11980512.html

Ok, thank you

CodePudding user response:

What pages and the web server to establish the websocket, then push data to the client, web server and Windows service to establish a two-way connection again, a little difficult for students, can study slowly, to execute a method after the specified time, to build a Windows service time to perform this method, method results are saved to the database, and then open your page regularly scan corresponding database, updated data, but also what tube efficiency, for teacher to see the results, rightnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  •  Tags:  
  • C#
  • Related