WebHandler ASHX .NET编译器错误:必须实现IsReusable匹配ReadOnly / WriteOnly

时间:2011-08-22 18:58:54

标签: asp.net ashx

我的任务是在大约8年前用VB.NET / ASP.NET编写的遗留网站添加Web处理程序,使用.NET framework 1.1.4322。

我不明白为什么我收到此错误消息:

Compiler Error Message: BC30154: 'Foo' must implement 'Overridable ReadOnly Property IsReusable() as Boolean' for interface 'System.Web.IHttpHandler'. Implementing property must have matching 'ReadOnly/WriteOnly' specifiers

这是我的代码:

<%@ WebHandler language="VB" class="Foo" %>
Imports System
Imports System.Web

Public Class Foo 
 Implements IHttpHandler

Public Sub ProcessRequest(context as HttpContext)
  Implements IHttpHandler.ProcessRequest
     'TO DO: Write request handling code here
End Sub

Public ReadOnly Property IsReusable() as Boolean 
Implements IHttpHandler.IsReusable
  Get
   Return False
  End Get
End Property

End Class

我也试过ReadOnly Overrides Property IsReusable()

1 个答案:

答案 0 :(得分:0)

您需要将IsReusable属性标记为Overridable而不是Overrides