Reputation: 2203
I've deployed ASP.net site on IIS and crashing into an null reference exception. It runs fine ASP.net development server but fails to load on the IIS.
I have tried reinstalling the IIS and even aspnet_regiis as well. But the error remains. Please find the error below.
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:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[NullReferenceException: Object reference not set to an instance of an object.]
_Default.Page_Load(Object sender, EventArgs e) +183
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +24
System.Web.UI.Control.LoadRecursive() +70
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3047
Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1
Upvotes: 1
Views: 1061
Reputation: 13
That's it, you should add your website under the default website, or you set in the IIS to start from your website.
Upvotes: 0
Reputation: 2203
I dont know how it worked but I just added the website as an application under Default Website and now its working.No errors now. Earlier I was adding this as an independent website.. Does anyone has an explanatio n for this>>?
Upvotes: 0
Reputation: 4327
Any objects that u may use in yr page load event, make sure u check if they are not null
if (myObject != null)
{
// do what u need to do
}
Upvotes: 1