我从供应商处获得了一个要安装在 IIS 上的示例应用程序,我正在测试该应用程序是否制作条形码。
aspx页面工作正常,但是当aspx页面调用ashx页面时,出现以下错误:
Server Error in '/BarcodeSample' 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 create type 'TECIT.OnlineBarcodes.BarcodeHandler'.
Source Error:
Line 1: <%@ WebHandler Language="C#" CodeBehind="BarcodeHandler.ashx.cs" Class="TECIT.OnlineBarcodes.BarcodeHandler" %>
Source File: /BarcodeSample/BarcodeHandler.ashx Line: 1
-------------------------------------------------------------------------------- Version Information: Microsoft .NET Framework Version:2.0.50727.3634; ASP.NET Version:2.0.50727.3634
为什么会发生这种情况?我怎样才能让这个 ashx 文件工作?
最佳答案
从命名空间开始检查类的全名(如果使用)。我遇到了同样的问题,在更改类名后解决了这个问题:
<%@ WebHandler Language="C#" Class="Namespace.ClassName" %>
而不是这个:
<%@ WebHandler Language="C#" Class="ClassName" %>
关于asp.net - ASHX 文件解析器错误 - 无法创建类型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14822295/