本文介绍了对象引用未设置为IIS的对象实例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

hii,

我有一个问题我的应用程序在本地计算机上工作正常但在IIS服务器上。不知道该怎么做才能在本地机器上正常工作。它显示一些例外情况: -



对象引用未设置为对象的实例。



描述:执行当前Web请求期间发生了未处理的异常。请查看堆栈跟踪以获取有关错误及其源自代码的位置的更多信息。



异常详细信息: System.NullReferenceException:对象引用未设置为对象的实例。



来源错误:





第61行:}

第62行:}

第63行:if(selectAllFile.Checked == true)

第64行:{}

第65行:else {



源文件:E:\ ConfidentPDR \ ConfidentPDR(2014年9月2日)\ ConfidentPDR(8月19日)\ ManuHelp.ConfidentPDR.Presentation。 MVC \Appointments\FileEntryManagement.aspx.cs行:63



堆栈追踪:





[NullReferenceException:对象引用未设置为对象的实例。]

ManuHelp.ConfidentPDR.Presentation.MVC.Appointments.FileEntryManagement.OnPreRender (EventArgs e)E:\ ConfidentPDR \ ConfidentPDR(2014年9月2日)\ ConfidentPDR (8月19日)\ ManuHelp.ConfidentPDR.Presentation.MVC \ Appointments; \\ FileEntryManagement.aspx.cs:63

System.Web.UI.Control.PreRenderRecursiveInternal()+112

System.Web.UI.Page.ProcessRequestMain(布尔includeStagesBeforeAsyncPoint,布尔includeStagesAfterAsyncPoint)+4296



这里是源代码: -



hii,
I have a problem my application works fine on local machine but on IIS server .Don't know what to do its works fine on local machine.it show some Exception like:-

"Object reference not set to an instance of an object."

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.

Source Error:


Line 61: }
Line 62: }
Line 63: if (selectAllFile.Checked == true)
Line 64: {}
Line 65: else{

Source File: E:\ConfidentPDR\ConfidentPDR(2 Sept 2014)\ConfidentPDR(19 Aug)\ManuHelp.ConfidentPDR.Presentation.MVC\Appointments\FileEntryManagement.aspx.cs Line: 63

Stack Trace:


[NullReferenceException: Object reference not set to an instance of an object.]
ManuHelp.ConfidentPDR.Presentation.MVC.Appointments.FileEntryManagement.OnPreRender(EventArgs e) in E:\ConfidentPDR\ConfidentPDR(2 Sept 2014)\ConfidentPDR(19 Aug)\ManuHelp.ConfidentPDR.Presentation.MVC\Appointments\FileEntryManagement.aspx.cs:63
System.Web.UI.Control.PreRenderRecursiveInternal() +112
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +4296

here is the Source Code :-

protected override void OnPreRender(EventArgs e)
       {
           base.OnPreRender(e);
           if (Session["PdfFile"] == null)
           {
               PDFfileName.Visible = false;
               Pdf_Fram.Visible = false;
               placeHolderPdfList.Visible = true;

               System.Web.UI.WebControls.CheckBox selectAllFile = null;
               foreach (DataListItem item in pdfDataList.Controls)
               {
                   if (item.ItemType == ListItemType.Header)
                   {
                       selectAllFile = (System.Web.UI.WebControls.CheckBox)item.FindControl("selectAllFile");
                   }
               }
               if (!selectAllFile.Checked)
               {
                   BindPDFList();
               }
           }
       }





页面加载:

protected void Page_Load(object sender, EventArgs e)
       {
           try
           {
               if (Session["PdfFilePath"] != null)
               {
                   Session["PdfFilePath"] = null;
               }

               if (Session["PdfFile"] == null)
               {
                   Pdf_Fram.Visible = false;
                   placeHolderPdfList.Visible = true;
               }

               if (!Page.IsPostBack)
               {
                   BindPDFList();

               }
           }
           catch
           {
               Session["PdfFilePath"] = null;
           }
       }

推荐答案


这篇关于对象引用未设置为IIS的对象实例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-27 13:09