相关疑难解决方法(0)

什么是NullReferenceException,我该如何解决?

我有一些代码,当它执行时,它抛出一个NullReferenceException,说:

你调用的对象是空的.

这是什么意思,我该怎么做才能解决这个错误?

.net c# vb.net null nullreferenceexception

1876
推荐指数
24
解决办法
127万
查看次数

为什么HttpContext.Current为null?

我有一个在所有应用程序中使用的值; 我在application_start中设置了它

  void Application_Start(object sender, EventArgs e)
  {
    Dictionary<int, IList<string>> Panels = new Dictionary<int, IList<string>>();
    List<clsPanelSetting> setting = clsPanelSettingFactory.GetAll();
    foreach (clsPanelSetting panel in setting)
    {
        Panels.Add(panel.AdminId, new List<string>() { panel.Phone,panel.UserName,panel.Password});
    }
    Application["Setting"] = Panels;

    SmsSchedule we = new SmsSchedule();
    we.Run();

  }
Run Code Online (Sandbox Code Playgroud)

并在SmsSchedule

public class SmsSchedule : ISchedule
{
    public void Run()
    {           
        DateTimeOffset startTime = DateBuilder.FutureDate(2, IntervalUnit.Second);
        IJobDetail job = JobBuilder.Create<SmsJob>()
            .WithIdentity("job1")
            .Build();

        ITrigger trigger = TriggerBuilder.Create()
             .WithIdentity("trigger1")
             .StartAt(startTime)
             .WithSimpleSchedule(x => x.WithIntervalInSeconds(60).RepeatForever())
             .Build();

        ISchedulerFactory sf = new StdSchedulerFactory();
        IScheduler sc …
Run Code Online (Sandbox Code Playgroud)

c# asp.net iis httpcontext

42
推荐指数
3
解决办法
9万
查看次数

标签 统计

c# ×2

.net ×1

asp.net ×1

httpcontext ×1

iis ×1

null ×1

nullreferenceexception ×1

vb.net ×1