相关疑难解决方法(0)

.NET中的调试与发布

继续上一个问题,是否有一个全面的文档列出了C#应用程序中调试和发布模式之间的所有可用差异,特别是在Web应用程序中?

有什么区别?

.net c# asp.net

55
推荐指数
7
解决办法
3万
查看次数

错误1053服务未及时响应启动或控制请求

我已经创建并安装了几次服务.最初它工作正常,但在服务代码中的一些更改后,当我在Services.msc中重新启动服务时,它开始给出错误:

错误1053:服务未及时响应启动或控制请求

码:

public partial class AutoSMS : ServiceBase
{
    public AutoSMS()
    {
        InitializeComponent();
        eventLog1.Clear();

        if (!System.Diagnostics.EventLog.SourceExists("MySource"))
        {
            System.Diagnostics.EventLog.CreateEventSource(
                "MySource", "MyNewLog");
        }
        eventLog1.Source = "MySource";
        eventLog1.Log = "MyNewLog";

        Timer checkForTime = new Timer(5000);
        checkForTime.Elapsed += new ElapsedEventHandler(checkForTime_Elapsed);
        checkForTime.Enabled = true;

    }

    protected override void OnStart(string[] args)
    {
        eventLog1.WriteEntry("In OnStart");
    }

    protected override void OnStop()
    {
        eventLog1.WriteEntry("In onStop.");
    }


    void checkForTime_Elapsed(object sender, ElapsedEventArgs e)
    {
        string Time = "15:05:00";
        DateTime dateTime = DateTime.ParseExact(Time, "HH:mm:ss",
                                        CultureInfo.InvariantCulture);

        if (DateTime.Now == dateTime) ;
            eventLog1.WriteEntry(Time); …
Run Code Online (Sandbox Code Playgroud)

.net c# timer

48
推荐指数
10
解决办法
15万
查看次数

标签 统计

.net ×2

c# ×2

asp.net ×1

timer ×1