[英]asp.Net 2005 “Could not load type”
Although I have seen dozens of forum questions relating to "Could not load type", none of the advice in them seemed to apply to my situation. 虽然我已经看过几十个与“无法加载类型”相关的论坛问题,但它们中没有任何建议似乎适用于我的情况。
I wrote a new web application using aspx.net VB 2005. It is tiny, with just 2 pages, 1 of which has no code-behind. 我使用aspx.net VB 2005编写了一个新的Web应用程序。它很小,只有2页,其中1页没有代码隐藏。 It runs aok in the IDE but when I installed it on my pc (and also when installed on the production server), and tried to run it this error came up:
它在IDE中运行,但是当我将它安装在我的电脑上时(以及安装在生产服务器上时),并试图运行它,这个错误出现了:
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 'EMTTrainingDatabase.pageMain'.
Source Error:
Line 1: <%@ Page Language="vb" AutoEventWireup="false" CodeBehind="pageMain.aspx.vb" Inherits="EMTTrainingDatabase.pageMain" %>
Line 2:
Line 3: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Source File: /EMTTrainingDatabase/pageMain.aspx Line: 1
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.3603; ASP.NET Version:2.0.50727.3082
I checked the web site properties in IIS and the correct ASP.net version is specified: 2.0.50727. 我检查了IIS中的网站属性,并指定了正确的ASP.net版本:2.0.50727。
I checked the virtual path and it looks correct too: /EMTTrainingDatabase 我检查了虚拟路径,它看起来也是正确的:/ EMTTrainingDatabase
pageMain source code header looks like: pageMain源代码标题如下所示:
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="pageMain.aspx.vb" Inherits="EMTTrainingDatabase.pageMain" %>
Some posters suggest that the bin is in the wrong folder or the bin doesn't contain the rigt contents. 一些海报表明垃圾箱位于错误的文件夹中,或垃圾箱中不包含严格的内容。 I don't have enough knowledge to evaulate this.
我没有足够的知识来证明这一点。
Can someone help? 有人可以帮忙吗?
Thank you. 谢谢。
For the benefit of others who might have had the same error, it can also come due to the ASP.NET runtime being unable to locate the /bin folder. 为了其他可能有相同错误的人的利益,也可能是由于ASP.NET运行时无法找到/ bin文件夹。
For this, make sure you have marked the virtual directory containing your application as a web application root. 为此,请确保已将包含应用程序的虚拟目录标记为Web应用程序根目录。
eg In godaddy web hosting you should mark Set Application Root to the folder/sub-folder containing your application. 例如,在godaddy Web托管中,您应将Set Application Root标记为包含您的应用程序的文件夹/子文件夹。 (Making it a virtual directory is not enough).
(使其成为虚拟目录是不够的)。
Hope it will help someone. 希望它会帮助某人。
I was able to find the answer to my problem: 我能够找到问题的答案:
When I added content to the deployment project, the dll was not in the bin. 当我向部署项目添加内容时,dll不在bin中。 When I dragged it into the bin, the program worked.
当我把它拖进垃圾箱时,程序工作了。
只需用CodeFile替换CodeBehind属性即可
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.