5

我在视觉工作室有一个工作网站项目。我可以毫无问题地查看所有页面。

现在我从另一个 Web 应用程序项目中复制了 2 个文件:search.aspx search.aspx.vb

search.aspx 源代码片段

<%@ Page EnableViewState="true" EnableEventValidation="false" MetaDescription="<%$Resources:metadescription%>" Title="<%$Resources:pagetitle %>" Language="VB" MasterPageFile="~/main.master" AutoEventWireup="false" Inherits="search" Codebehind="search.aspx.vb" %>
<%@ MasterType VirtualPath="~/main.master" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>

search.aspx.vb 源代码片段

Imports System
Imports System.Net
Imports System.IO
Imports GlobalFunctions
Imports System.Xml
Imports System.Collections.Generic
Imports System.Collections
Imports System.Linq
Imports System.Resources
Imports generalMethods
Imports System.Globalization

Partial Class search
    Inherits System.Web.UI.Page

但是当我尝试请求页面时:www.test.com/search.aspx 我收到此错误:说明:在解析服务此请求所需的资源期间发生错误。请查看以下特定的解析错误详细信息并适当地修改您的源文件。

解析器错误消息:无法加载类型“搜索”。

源错误:

Line 1:  <%@ Page EnableViewState="true" EnableEventValidation="false" MetaDescription="<%$Resources:metadescription%>" Title="<%$Resources:pagetitle %>" Language="VB" MasterPageFile="~/main.master" AutoEventWireup="false" Inherits="search" Codebehind="search.aspx.vb" %>
Line 2:  
Line 3:  <%@ MasterType VirtualPath="~/main.master" %>

Source File: /search.aspx    Line: 1 

当我尝试构建项目时,我已经看到错误:无法加载类型“搜索”。
我不知道去哪里找这个了。

4

2 回答 2

11

原来我不得不在 search.aspx 中将“CodeBehind”更改为“CodeFile”......现在一切都恢复正常了。

于 2012-08-08T21:08:01.607 回答
2

如果 Web 服务器上 bin 目录中的 WAP DLL 已过时并且因此不包含所请求页面的预编译代码,也会发生这种情况。

于 2012-09-25T12:51:00.023 回答