解决'无法加载类型'错误

解决'无法加载类型'错误

问题描述:

我一直试图解决这个错误几个小时,我尝试了一切,我可以这样做没有成功。我真的是C#的新手。我想知道是否有人可以帮助我确定如何开始解决这个错误?解决'无法加载类型'错误

错误消息:

Could not load type 'Inventory1.Global'. W:\admin.fctl.ucf.edu\inventory\Global.asax 1 

的Global.asax内容:

<%@ Application Codebehind="Global.asax.cs" Inherits="Inventory1.Global" Language="C#"%> 

的Global.asax.cs内容:

using System; 
using System.Collections; 
using System.ComponentModel; 
using System.Web; 
using System.Web.SessionState; 

namespace Inventory1 
{ 
    /// <summary> 
    /// Summary description for Global. 
    /// </summary> 
    public class Global : System.Web.HttpApplication 
    { 
     /// <summary> 
     /// Required designer variable. 
     /// </summary> 
     private System.ComponentModel.IContainer components = null; 

     public Global() 
     { 
      InitializeComponent(); 
     } 

     protected void Application_Start(Object sender, EventArgs e) 
     { 

     } 

     protected void Session_Start(Object sender, EventArgs e) 
     { 

     } 

     protected void Application_BeginRequest(Object sender, EventArgs e) 
     { 

     } 

     protected void Application_EndRequest(Object sender, EventArgs e) 
     { 

     } 

     protected void Application_AuthenticateRequest(Object sender, EventArgs e) 
     { 

     } 

     protected void Application_Error(Object sender, EventArgs e) 
     { 

     } 

     protected void Session_End(Object sender, EventArgs e) 
     { 

     } 

     protected void Application_End(Object sender, EventArgs e) 
     { 

     } 

     #region Web Form Designer generated code 
     /// <summary> 
     /// Required method for Designer support - do not modify 
     /// the contents of this method with the code editor. 
     /// </summary> 
     private void InitializeComponent() 
     {  
      this.components = new System.ComponentModel.Container(); 
     } 
     #endregion 
    } 
} 
+0

MiGusta,这是你正试图修复远程服务器或本地机器上的代码..也有一个'W:\'驱动器在你试图运行/调试这个机器上。你甚至可以调试代码..?或者你只是在做一个代码并运行类型的场景..? – MethodMan 2013-02-27 17:39:33

+0

远程服务器。我正在调试过程中。我想要做的是在Visual Studio中重建'Inventory'项目并创建一个新的.dll文件,因为旧的应用程序已停机数天。所以我需要调试这个代码才能重建,这是我一直想要做的一段时间。上面的错误是我得到的唯一错误。 – AnchovyLegend 2013-02-27 17:41:18

+0

那么你的本地机器从哪里运行(当你试图调试时)呢? – CodingGorilla 2013-02-27 17:43:27

该代码工作在我的机器上。检查以确保Dll存在于/ bin目录中。另外,请确保bin和Global.asax文件存在于应用程序的根目录中。服务器级别的人很可能在IIS中改变了某些东西。

+0

Josh通过'在IIS中更改了某些内容“,您是否指OP中​​的虚拟目录路径..? – MethodMan 2013-02-27 17:45:31

+0

旧的.dll错误/过时并导致应用程序崩溃。我正在尝试创建一个新的库重建库存项目,那么解决此问题的好方法是什么? – AnchovyLegend 2013-02-27 17:48:43

+0

@DJKRAZE - 是。有时候,如果开发人员不知道它的路径,那么它们就不会在根目录中工作。 – Josh 2013-02-27 19:16:57