This error is coming when i have uploaded the website on serverServer 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: Line 43: Label1.Text = "View All Blogs";Line 44: Line 45: ent.GetEntryList(Repeater1);Line 46: }Line 47: Source File: e:\HostingSpaces\ims4maths\blog.ims4maths.com\wwwroot\Default.aspx.cs Line: 45 Stack Trace: [NullReferenceException: Object reference not set to an instance of an object.] IMS.DAL.Functions..cctor() in D:\Saba\Final IMS Blog\IMS.DAL\Functions.cs:20[TypeInitializationException: The type initializer for 'IMS.DAL.Functions' threw an exception.] IMS.DAL.Functions.ExecuteSelectCommand(String CommandName) in D:\Saba\Final IMS Blog\IMS.DAL\Functions.cs:55 IMS.DAL.EntriesDb.GetEntryList() in D:\Saba\Final IMS Blog\IMS.DAL\EntriesDb.cs:38 IMS.BLL.EntriesAction.GetEntryList(Repeater rep) in D:\Saba\Final IMS Blog\IMS.BLL\EntriesAction.cs:39 Default.ShowAllBlogs() in e:\HostingSpaces\ims4maths\blog.ims4maths.com\wwwroot\Default.aspx.cs:45 Default.Page_Load(Object sender, EventArgs e) in e:\HostingSpaces\ims4maths\blog.ims4maths.com\wwwroot\Default.aspx.cs:37 System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +51 System.Web.UI.Control.OnLoad(EventArgs e) +92 System.Web.UI.Control.LoadRecursive() +54 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +772 解决方案 From http://www.dotnetperls.com/nullreferenceexception[^]:The program defines the Main entry point. The string reference variable is assigned to the null literal. Next, the Length property is accessed on the string reference. The program compiles correctly, but will always throw an execution.Note:You cannot access an instance property like Length on a null reference. An exception will always occur.You need to debug your program and check for all possible null values.[Update]Check ent and Repeater1 object for null values before using it.   --Amy 这篇关于在本地服务器中,该文件未显示任何错误,但在Web服务器上显示此错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
10-16 22:05