我在将基于 .NET 2.0 并用 C# 编写的旧版 Web 应用程序移动到新的 Windows 2012 Foundation Server 时遇到问题。IIS 7.0 已配置为 ASP.NET 经典模式。
几乎所有页面都显示以下错误。
我想知道生成此错误的源代码部分是什么,但消息显示[No relevant source lines]
.
你有什么想法吗?
Server Error in '/' Application.
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:
[No relevant source lines]
Source File: c:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\813bde8d\3a1aaa6a\App_Web_uc_elencoviaggi.ascx.572aee0e.phamg6cd.0.cs Line: 0
Stack Trace:
[NullReferenceException: Object reference not set to an instance of an object.]
Makr.UI.PagamentiDataContext..ctor() +28
Makr.UI.Viaggi.UC_ElencoViaggi..ctor() +26
ASP.viaggi_uc_elencoviaggi_ascx..ctor() in c:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\813bde8d\3a1aaa6a\App_Web_uc_elencoviaggi.ascx.572aee0e.phamg6cd.0.cs:0
ASP.amministrazione_elencoviaggi_aspx.__BuildControlUC_ElencoViaggi1() in c:\inetpub\wwwroot\WebApp_Makr_Contabilita\Amministrazione\ElencoViaggi.aspx:6
ASP.amministrazione_elencoviaggi_aspx.__BuildControlContent2(Control __ctrl) in c:\inetpub\wwwroot\WebApp_Makr_Contabilita\Amministrazione\ElencoViaggi.aspx:5
System.Web.UI.CompiledTemplateBuilder.InstantiateIn(Control container) +12
ASP.master_amministrazione_master.__BuildControlContentPlaceHolder1() in c:\inetpub\wwwroot\WebApp_Makr_Contabilita\Master\Amministrazione.Master:150
ASP.master_amministrazione_master.__BuildControlform1() in c:\inetpub\wwwroot\WebApp_Makr_Contabilita\Master\Amministrazione.Master:13
ASP.master_amministrazione_master.__BuildControlTree(master_amministrazione_master __ctrl) in c:\inetpub\wwwroot\WebApp_Makr_Contabilita\Master\Amministrazione.Master:1
ASP.master_amministrazione_master.FrameworkInitialize() in c:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\813bde8d\3a1aaa6a\App_Web_9f0g2exr.0.cs:0
System.Web.UI.UserControl.InitializeAsUserControlInternal() +35
System.Web.UI.MasterPage.CreateMaster(TemplateControl owner, HttpContext context, VirtualPath masterPageFile, IDictionary contentTemplateCollection) +8696687
System.Web.UI.Page.get_Master() +51
System.Web.UI.Page.ApplyMasterPage() +15
System.Web.UI.Page.PerformPreInit() +45
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +282
这是页面的代码:
<%@ Page Language="C#" EnableEventValidation="false" Theme="default" MasterPageFile="~/Master/Amministrazione.Master" AutoEventWireup="true" CodeBehind="ElencoViaggi.aspx.cs" Inherits="Makr.UI.Amministrazione.ElencoViaggi" Title="Untitled Page" %>
<%@ Register src="../Viaggi/UC_ElencoViaggi.ascx" tagname="UC_ElencoViaggi" tagprefix="uc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<uc1:UC_ElencoViaggi ID="UC_ElencoViaggi1" runat="server" />
</asp:Content>