In Production Web App Giving Parse Error
My problem is that my company's website has recently been getting the following parse error:
Server Error in '/' Application.
Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.
Parser Error Message: Could not load type 'namespace.Index'.
Source Error:
Line 1: <%@ Page Language="C#" AutoEventWireup="true" Inherits="namespace.Index" CodeBehind="Index.aspx.cs" %>
Line 2:
Line 3: <!DOCTYPE html PUBLIC "..." />
Source File: /Index.aspx Line: 1
Now this website has been running just fine for a while with the last code changes about two months ago. In the pas开发者_如何学编程t 2 weeks though this is the third time the parse error has appeared. I have fixed it each time by rebuilding the project in visual studios and publishing it, but in a few days it comes back. I have no idea what is causing this error, as I said there have been no code changes in the past 2 months. Does anyone know what could be causing the parse error to appear?
EDIT: Not sure if this will help but all the HTML pages of the site still show up no problem even when this error is occurring on the asp pages. Also this error has occurred 5 times and now it seems to take 2 or 3 re-publishes of the site before the site will comeback up.
I've been able to solve these weird and obscure errors doing one, a combination or all three of the following:
- ELMAH
- HealthMonitoring
- Try/Catch around every piece of code to try and isolate
ELMAH and HM catch different errors and they catch them differently. The try/catch allows you to isolate the code. Onbviously, the try/catch is reasonable if you have an idea of where the problem is - one page, data access, etc.
Are you running any anti-virus software on the server? If so can you exclude the web app's directory?
I would also recommend using fuslogvw (part of the .NET SDK) to see if there are any assembly binding failures.
精彩评论