简体   繁体   English

ASP.NET:无法加载类型

[英]ASP.NET: Could not load type

I'm getting the following error: 我收到以下错误:

Could not load type 'Intel.Intel'.

I copied my entire Visual Studio 2010 folder before I formatted my computer and I copy/replaced the same folder with this one after I installed windows again. 在格式化计算机之前,我已复制了整个Visual Studio 2010文件夹,并且在再次安装Windows之后,我用这个文件夹复制/替换了同一文件夹。 I'm running this locally not on a host server. 我不在本地运行此主机服务器上。 Anyone know what I'm doing wrong? 有人知道我在做什么错吗? I've search google and find many pages giving solutions for this, but none seem to fix my problem. 我已经搜索过google,发现有很多页面为此提供了解决方案,但似乎没有一个可以解决我的问题。 Let me know if I need to provide anymore additional information. 让我知道是否需要提供其他信息。 Thanks! 谢谢!

Update: Sorry I was unclear I copied the "Visual Studio 2010" folder from under my documents. 更新:对不起,我不清楚我是从文档下面复制了“ Visual Studio 2010”文件夹。 I've installed Visual Studio 2010 Premium from my MSDN account. 我已经从我的MSDN帐户安装了Visual Studio 2010 Premium。

Update 2: I also forgot that I was getting this error below before the Could not load type error. 更新2:我也忘记了在无法加载类型错误之前,我在下面遇到此错误。 I fixed it by replacing the "~" with ".". 我通过将“〜”替换为“。”来修复它。 The strange thing is that while that will seem to fix that error -- If I try locating the file through the "Pick Master.." option when retyping "MasterPageFile=" it will give me the path with the tilda and yet it wont work. 奇怪的是,虽然这似乎可以解决该错误-如果在重新键入“ MasterPageFile =“时尝试通过“ Pick Master ..”选项查找文件,它将为我提供带有tilda的路径,但它无法正常工作。 I don't know if this helps identify the overall problem or not. 我不知道这是否有助于确定总体问题。

The file '/Intel.Master' does not exist.

And below notice the "~/Intel.Master" -- as mentioned above I can get rid of this error by changing that to "./Intel.Master" 并在下面注意“〜/ Intel.Master”-如上所述,我可以通过将其更改为“ ./Intel.Master”来摆脱此错误。

<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Intel.Master" CodeBehind="Index.aspx.vb" Inherits="Intel.Index" %>

Found a solution. 找到了解决方案。

I looked in IIS Manager and I found that my application was a folder icon and not an application icon. 我查看了IIS管理器,发现我的应用程序是文件夹图标,而不是应用程序图标。 So I right clicked it and selected "Convert to Application". 因此,我右键单击它并选择“转换为应用程序”。 After doing this it solved that error and now I have another one. 完成此操作后,它解决了该错误,现在我又遇到了一个错误。 I feel however that this solution did "fix" the problem. 但是,我觉得此解决方案确实“解决了”问题。

There are a bunch of registry settings that would be missing installing in this manner. 以这种方式安装将丢失大量注册表设置。 Also there are components (shared) that are installed outside of the VS2010 folder. 也有一些组件(共享)安装在VS2010文件夹之外。

Your best bet would be to re-install Studio in the usual (from media) route. 最好的选择是以通常的方式(从媒体)重新安装Studio。

Based on EDIT: 基于编辑:

The types that are missing look like they were previously stored in the GAC. 丢失的类型看起来像以前存储在GAC中一样。 Delete the reference in the project and re-create referencing the actual assembly file (DLL) 删除项目中的引用,然后重新创建引用实际的程序集文件(DLL)

要将引用重新添加到您的项目中,请打开您的项目,下拉您的解决方案文件夹,然后打开您的项目-找到引用节点,右键单击它选择添加引用,然后根据所处的位置浏览.net程序集和或文件选项卡。 dll是,找到您的dll并双击它。

Replace the CodeBehind By CodeFile and remove the namespace. CodeFile替换CodeBehind然后删除名称空间。 before the Inherits class name. Inherits类名称之前。 For example: 例如:

Wrong: 错误:

<%@ Page Title="" Language="vb" AutoEventWireup="false"
MasterPageFile="~/Intel.Master" **CodeBehind**="Index.aspx.vb"
Inherits="**Intel.Index**" %>

Right: 对:

<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Intel.Master" **CodeFile**="Index.aspx.vb"
Inherits="**Index**" %>

it works I promise 我保证它有效

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM