我有一个使用 ASP.Net MVC 开发的网站,并使用 Log4net 进行异常记录。该网站运行良好,直到大约 4 小时前。在过去 2 周内,我们没有对网站进行任何更改。自从我们在大约 1 个月前建立网站以来,该网站一直运行顺利。该网站由我们的 ISP 托管在共享主机帐户上。
这是我们收到的例外情况:
[FormatException: String was not recognized as a valid Boolean.]
log4net.Core.LoggerManager.RegisterAppDomainEvents() +0
log4net.Core.LoggerManager..cctor() +33
[TypeInitializationException: The type initializer for 'log4net.Core.LoggerManager' threw an exception.]
log4net.Core.LoggerManager.GetLogger(Assembly repositoryAssembly, String name) +0
log4net.LogManager.GetLogger(Assembly repositoryAssembly, String name) +8
log4net.LogManager.GetLogger(String name) +20
i3t.LcaWeb.View.MvcApplication..cctor() in Global.asax.cs:17
[TypeInitializationException: The type initializer for 'i3t.LcaWeb.View.MvcApplication' threw an exception.]
i3t.LcaWeb.View.MvcApplication..ctor() +0
ASP.global_asax..ctor() in App_global.asax.fqjmwqjv.0.cs:0
[TargetInvocationException: Exception has been thrown by the target of an invocation.]
System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandle& ctor, Boolean& bNeedSecurityCheck) +0
System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean fillCache) +86
System.RuntimeType.CreateInstanceImpl(Boolean publicOnly, Boolean skipVisibilityChecks, Boolean fillCache) +230
System.Activator.CreateInstance(Type type, Boolean nonPublic) +67
System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) +1051
System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) +111
System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +215
System.Web.HttpApplicationFactory.FireApplicationOnStart(HttpContext context) +8878568
System.Web.HttpApplicationFactory.EnsureAppStartCalled(HttpContext context) +136
System.Web.HttpApplicationFactory.GetApplicationInstance(HttpContext context) +92
System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr) +289
在 Global.asax 中引发了异常,其中log4net.ILog
正在创建一个实例:
public class MvcApplication : System.Web.HttpApplication
{
private static log4net.ILog log = log4net.LogManager.GetLogger("global.asax");
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
"Home.aspx",
"",
new { action = "Index", controller = "Home" }
);
该问题不会在测试中发生 - 我们无法重现它。我已经删除了现场网站上的所有文件,并重新上传了它们,以防万一某些东西可能已损坏,但这并没有解决问题。
我相信在 ISP 方面可能发生了一些改变,从而破坏了某些东西。
关于如何解决这个问题的任何线索?