小编Hoa*_*ran的帖子

如何停止或暂停 Quartz 作业

我已经执行了 2 个工作(MyJob1MyJob2),如下所示:

public async Task<ActionResult> ScheduleJob()
    {
        await _jobManager.ScheduleAsync<MyJob1>(
            job =>
            {
                job.WithIdentity("Job1Identity", "MyGroup")
                    .WithDescription("This is job 1");
            },
            trigger =>
            {
                trigger.StartNow()
                    .WithSimpleSchedule(schedule =>
                    {
                        schedule.RepeatForever()
                            .WithIntervalInSeconds(5)
                            .Build();
                    });
            });

        await _jobManager.ScheduleAsync<MyJob2>(
            job =>
            {
                job.WithIdentity("Job2Identity", "MyGroup")
                    .WithDescription("This is job 2");
            },
            trigger =>
            {
                trigger.StartNow()
                    .WithSimpleSchedule(schedule =>
                    {
                        schedule.RepeatForever()
                            .WithIntervalInSeconds(5)
                            .Build();
                    });
            });

        return Content("OK, scheduled!");
    }
Run Code Online (Sandbox Code Playgroud)

--> 我曾尝试使用_jobManager.Stop() 但它停止了我的所有工作,那么如何仅停止或暂停 MyJob2

quartz.net aspnetboilerplate

4
推荐指数
1
解决办法
5748
查看次数

通过HttpWebRequest进行Web API授权

我有一个函数来调用我的Web API.如果TestCallingRemotely设置为,它运行良好[AllowAnonymous].

var httpWebRequest = (HttpWebRequest)WebRequest.Create(
    "http://localhost/api/services/myApp/commonLookup/TestCallingRemotely");
httpWebRequest.ContentType = "application/json";
httpWebRequest.Method = "POST";

using (var streamWriter = new StreamWriter(httpWebRequest.GetRequestStream())) {
    string input = "{}";

    streamWriter.Write(input);
    streamWriter.Flush();
    streamWriter.Close();
}

var httpResponse = (HttpWebResponse)httpWebRequest.GetResponse();
Run Code Online (Sandbox Code Playgroud)

如何通过usernamepasswordHttpWebRequest授权?

我需要从CLR集成调用我的Web API,它只支持System.Net.

c# httpwebrequest http-request-parameters asp.net-web-api aspnetboilerplate

3
推荐指数
2
解决办法
1万
查看次数

无论如何将long转换为int?

也许这是一个愚蠢的问题:我不小心将长值转换为数据库中的int值(~1M行),所以有没有办法使用代码将其还原(不恢复数据库)?谢谢

示例:我的长值:636705792000000000

施法后的Int值:1587019776

==>当我只有int值时,有没有办法找到636705792000000000(1587019776)

c# integer casting long-integer

3
推荐指数
1
解决办法
765
查看次数

ASP.NET Boilerplate:四眼原理的最佳解决方案是什么

我想为ASP.NET Boilerplate框架添加4眼原则.这意味着在应用于系统之前,角色,用户等的每个更改都需要(由另一个管理员)批准.我搜索了一段时间但没有回答.那么这个流程的最佳解决方案是什么?

我可以使用Abp表(dbo.AbpUser_Temp等)创建相同的表,并且所有更改都将存储在这些表中吗?有没有更好的解决方案?

示例:在应用程序中,Admin1创建了一个名为User1的用户.但是,在Admin2批准之前,此用户无法登录该应用程序.

aspnetboilerplate

1
推荐指数
1
解决办法
772
查看次数