分析器错误:无法加载类型 [英] Parser error: Could not load type

查看:69
本文介绍了分析器错误:无法加载类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨!

现在,我知道你在想什么(不是另一个解析器错误!)。但我的情况很独特。 (不,真的!;-))我可以使用你的帮助。让我告诉你错误是什么:



'/'应用程序中的服务器错误。 
---------------------------------------------- ----------------------------------

解析器错误
描述:在解析为此请求提供服务所需的资源期间发生错误。请查看以下特定的解析错误详细信息并相应地修改源文件。

解析器错误消息:无法加载类型'TestCert'。

来源错误:


第1行:<%@ Page 语言 = C# AutoEventWireup = true CodeBehind = TestCert.aspx.cs 继承 = TestCert %>
第2行:
第3行:< !DOCTYPE html PUBLIC - // W3C // DTD XHTML 1.0 Transitional // EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd >


源文件:/TestCert.aspx行:1


----- -------------------------------------------------- -------------------------
版本信息:Microsoft .NET Framework版本:2.0.50727.3625; ASP.NET版本:2.0.50727.3634







情况是我有一堆.aspx和https后面的.aspx.cs文件,所有文件都在一起。没有解决方案文件,也没有项目文件(不是我的想法)。



到目前为止我尝试了什么:

1.项目文件名为TestMMW,因此整个命名空间位于命名空间TestMMW下。我尝试关闭命名空间(您在上面看到)。错误。

2.我尝试重新打开命名空间。错误。

3.我注意到它在.Net和ASP.NET的第2版下运行,所以我安装了Visual Studio 2008(确定 - 我通常在VS 2010下工作),在那里编译确保.Net版本为2.0,并将其FTP过来。错误。



我为接下来的尝试而感到茫然。你能帮帮我吗?



谢谢!

解决方案

检查代码隐藏类是否为



公共部分类TestCert:页面

{



}



还可以尝试更改CodeBehind =" TestCert.aspx.cs" to CodeFile =" TestCert.aspx.cs"。当您将项目类型从网站更改为Web应用程序或反之亦然时,需要进行此更改。



因为您说该项目不包含项目文件或解决方案文件,我认为问题出在这里。 IIS无法理解项目类型。



由于您正在FTP到IIS,您确定使用的是.NET 2.0 AppPool吗?

有同样的问题,通过验证IIS中应用程序池的Netframeworkversión来解决。我的应用程序是versión4.0,应用程序池是2.0。将App池中的它从2.0更改为4.0并且工作正常,无需将CodeBehind更改为CodeFile。


尝试将bin文件夹复制到您的Web服务器。


Hi!
Now, I know what you're thinking ("Not another parser error!"). But my situation is unique. (No, really! ;-) ) I could use your help. Let me tell you what the error is:

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 'TestCert'.

Source Error:


Line 1:  <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="TestCert.aspx.cs" Inherits="TestCert" %>
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: /TestCert.aspx    Line: 1


--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.3625; ASP.NET Version:2.0.50727.3634




The situation is I have a bunch of .aspx and .aspx.cs files behind https, all in a lump together. There is no solution file and no project file (not my idea).

What I've tried so far:
1. The project file is called TestMMW, so the whole thing was under the namespace TestMMW. I tried taking the namespace off (which you see up above). Error.
2. I tried putting the namespace back on. Error.
3. I noticed that it's running under version 2 of .Net and ASP.NET, so I installed Visual Studio 2008 (to be sure - I generally work under VS 2010), compiled under there, making sure the .Net version was 2.0, and FTPd it over. Error.

I'm at a loss for what to try next. Can you help me, please?

Thanks!

解决方案

Check that the codebehind class is

public partial class TestCert:Page
{

}

Also try changing CodeBehind="TestCert.aspx.cs" to CodeFile="TestCert.aspx.cs". This change is required when you change project type from website to webapplication or vice versa.

Since you are saying that the project does not contain the project file or solution file, I think the problem is here. The IIS is not able to understand the project type.

Since you are FTPing to IIS, are you sure that you are using the .NET 2.0 AppPool ?


Had the same issue, solved by verifying the Netframework versión of the application pool in IIS. My application was versión 4.0 and the application pool was 2.0 . Changed it for the App pool from 2.0 to 4.0 and it worked fine, no need to change the CodeBehind to CodeFile.


Try to copy the bin folder to your webserver.


这篇关于分析器错误:无法加载类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆