错误:“/”应用程序解析器错误中的服务器错误,asp.net c#?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/18017940/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Error: Server Error in '/' Application Parser Error, asp.net c#?
提问by Saranya
In my application, other pages are running correctly, but this page is throwing an error.
在我的应用程序中,其他页面运行正常,但此页面抛出错误。
Code
代码
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="OutReport.aspx.cs" Inherits="HMS.OutReport" MasterPageFile="~/Site.Master" %>
<asp:Content runat="server" ID="BodyContent" ContentPlaceHolderID="MainContent">
</asp:Content>
Error
错误
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 'HMS.OutReport'.
Source Error:
Line 1:
Line 2: <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="OutReport.aspx.cs" Inherits="HMS.OutReport" MasterPageFile="./Site.Master" %>
Line 3: <asp:Content runat="server" ID="BodyContent" ContentPlaceHolderID="MainContent">
Line 4: </asp:Content>
Source File: /OutReport.aspx Line: 2
回答by Microsoft DN
Try changing CodeBehind="OutReport.aspx.cs"
to CodeFile="OutReport.aspx.cs"
尝试更改CodeBehind="OutReport.aspx.cs"
为CodeFile="OutReport.aspx.cs"
EDIT:
编辑:
A CodeBehindNeeds to be compiled ( asp.net 1.1 model) and compiled binary is placed in the bin folder of the website. You need to do a compile in visual studio before you deploy. Good model when you do not want the source code to be viewable as plain text ... for example when delivering to a customer who you not have obligation to provide code.
一个CodeBehind需要编译(asp.net 1.1模型),编译后的二进制文件放在网站的bin文件夹中。在部署之前,您需要在 Visual Studio 中进行编译。当您不希望以纯文本形式查看源代码时的良好模型……例如,当交付给您没有义务提供代码的客户时。
A CodeFilefile is located and compiled by ASP.NET at runtime, on demand. You can "pre-compile" your web site to fall back on the older model, which is useful if you won't want to deploy your source code to every web site. But by default, your CodeFile file is a .cs file that is deployed to the site, and the class is generated in the ASP.NET temporary storage folder.
一个的CodeFile文件位于由ASP.NET运行时编译需求。您可以“预编译”您的网站以使用旧模型,如果您不想将源代码部署到每个网站,这将非常有用。但是默认情况下,您的 CodeFile 文件是部署到站点的 .cs 文件,并且该类是在 ASP.NET 临时存储文件夹中生成的。
In your code you are telling ASP.NET to ignore the presence of the C# file, and only look for it in the compiled assembly. ASP.NET is, in turn, telling you that the compiled assembly doesn't actually contain the class you told it to look for.
在您的代码中,您告诉 ASP.NET 忽略 C# 文件的存在,而只在已编译的程序集中查找它。反过来,ASP.NET 会告诉您编译后的程序集实际上并不包含您告诉它要查找的类。
回答by Vasanth
It is not able to resolve reference to "HMS.OutReport", import reference to the namespace containing OutReport class.
它无法解析对“HMS.OutReport”的引用,导入对包含 OutReport 类的命名空间的引用。
回答by Conrad Lotz
Check in you codebehind file (OutReport.aspx.cs
) if the namespace match HMS.OutReport
OutReport.aspx.cs
如果命名空间匹配,则签入代码隐藏文件 ( )HMS.OutReport
namespace HMS
{
public class OutReport
....
....
回答by Ajay
A detailed postabout the possible reasons of this error, with solutions.
关于此错误的可能原因的详细帖子,以及解决方案。
And see also
另见
I had this error when the .NET version was wrong - make sure the site is configured to the one you need.
当 .NET 版本错误时,我遇到了此错误 - 确保将站点配置为您需要的站点。
See aspnet_regiis.exefor details.
有关详细信息,请参阅aspnet_regiis.exe。
I think this link will solve your issue
我认为此链接将解决您的问题
回答by Victor Cochoy
Check the disk space, I gave a similiar error but it was for that very reason.
检查磁盘空间,我给出了一个类似的错误,但正是出于这个原因。